Wiki articles tagged with "model"

Showing 1-20 of 28 items.

Inline views, write less

Created 12 years ago by Firebreaker Firebreaker, updated 12 years ago by Firebreaker Firebreaker.

Sometimes writing views like

3 0
3 followers
Viewed: 13 219 times
Version: Unknown (update)
Category: Tips

How to preload dropdowns in CForm

Created 12 years ago by transistor transistor, updated 12 years ago by transistor transistor.

So you want to use CForm (form builder), but need to preload dropdowns in a form? It's simpler than it seems.
You got your CFormModel, CForm and the actual Form, right?
Let's say you have the typical State -> City dependent dropdowns, so you would want to load the from with the State and City selected.

1 0
2 followers
Viewed: 13 857 times
Version: Unknown (update)
Category: Tips

Generate CTreeview from database table and update a model

Created 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

Suppose we want to set a category to product (or an item in general term), Also suppose categories has sub-categories (multi-level)

1 0
1 follower
Viewed: 15 393 times
Version: 1.1
Category: How-tos

A universal model attribute for its synthetic representation

Created 9 years ago by Alexandre Rodichevski Alexandre Rodichevski, updated 9 years ago by Alexandre Rodichevski Alexandre Rodichevski.

It is convenient to use the same identification attribute, say info, in all of the active records of your application. It should be a virtual read-only attribute defined by a getter method, its label being the model name.

0 0
3 followers
Viewed: 17 594 times
Version: 2.0
Category: Tips

Application-driven database with CDbMigration and an extended CActiveRecord

Created 14 years ago by Tudor Ilisoi Tudor Ilisoi, updated 14 years ago by Tudor Ilisoi Tudor Ilisoi.

This is an incipient implementation of application-driven database with Yii.

8 0
10 followers
Viewed: 18 237 times
Version: 1.1
Category: Others

Active Record snapshotting (Model data base history)

Created 10 years ago by Bizley Bizley, updated 10 years ago by Bizley Bizley.

One of the common tasks the web application might be required to perform, especially the app using some kind of a CMS, is to save the history of data changes. Your client for sure will want the answer to this simple question - If I mess this up or delete by accident can we bring it back? Well, DB backup is one thing and quick recovery is another - let's talk about latter one.

1 0
5 followers
Viewed: 18 712 times
Version: 1.1
Category: Tutorials

Expert's model generation with Gii

Created 11 years ago by le_top le_top, updated 11 years ago by le_top le_top.

Efficient coding with Yii implies efficient use of the code generator. This article shares the personalised Gii templates that were built starting from the standard templates proposed by AweGen.

1 0
2 followers
Viewed: 19 505 times
Version: 1.1
Category: Tips

Insert a model record using CGridview

Created 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

CGridview displays existent rows of the table (using DataProvider)

2 0
1 follower
Viewed: 19 813 times
Version: 1.1
Category: How-tos

ClientValidation for files (modern browsers)

Created 12 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by CeBe CeBe.

There are cases that you want to validate the file format, size, extension etc but how to do that without submit the form ?

2 0
6 followers
Viewed: 20 856 times
Version: 1.1
Category: How-tos

model rules depended by user roles-permissions

Created 12 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 12 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

This is a reference about model validators and user roles. In many cases we want model validators to applied only for some privileged users or not

3 0
3 followers
Viewed: 21 391 times
Version: Unknown (update)
Category: How-tos

Sort and save order of model-elements drag & drop

Created 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

Suppose you have Products,Categories and each product belongs in many categories

1 0
4 followers
Viewed: 22 060 times
Version: 1.1
Category: Tutorials

Update CGridview row separately using ajax request

Created 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

There are cases you want to update a record on CGridview directly

5 0
8 followers
Viewed: 27 389 times
Version: 1.1
Category: How-tos

How To: Custom Client Validation On Checkbox Toggle and Optional Input Field

Created 9 years ago by Wade Shuler Wade Shuler, updated 9 years ago by Wade Shuler Wade Shuler.

I just chased my tail around for a bit today. I got lost with setting the status of all inputs, and banging my head on why the "validate" function just wasn't working.

0 0
1 follower
Viewed: 27 856 times
Version: 2.0
Category: How-tos

How to store array/widget configuration to the database with config validation rules

Created 11 years ago by Kartik V Kartik V, updated 11 years ago by Kartik V Kartik V.

Note the tag {{homeUrl}} will be dynamically replaced at runtime.

2 3
41 followers
Viewed: 28 109 times
Version: 2.0
Category: Tutorials

Generate a multi-lever array sub-category for a menu

Created 12 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

Everyone have seen a multilayer menu in several CMS

7 0
8 followers
Viewed: 30 795 times
Version: 1.1
Category: How-tos

Model validation for field ranges using yii2-field-range extension

Created 11 years ago by Kartik V Kartik V, updated 11 years ago by Kartik V Kartik V.

The yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.

0 0
37 followers
Viewed: 31 680 times
Version: 2.0
Category: Tips

Managing constants easily

Created 14 years ago by briiC.lv briiC.lv, updated 14 years ago by briiC.lv briiC.lv.

/*

    Get class constants by token.
    If you set constants with same prefix, like:
	MY_STATUS_1
	MY_STATUS_2
	MY_STATUS_3
4 0
7 followers
Viewed: 34 085 times
Version: 1.1
Category: Tips

Add model validator in Controller

Created 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 11 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz).

There are cases that model validators should be depended by controller/action and you couldn't manipulate on the model class or using scenarios in easy way

1 1
3 followers
Viewed: 35 047 times
Version: 1.1
Category: Tips

"safe" and "unsafe" Model validators (massive assignments)

Created 12 years ago by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz), updated 9 years ago by brianvu brianvu.

Ok, it is a little bit difficult to full understanding the unsafe validator.

2 2
7 followers
Viewed: 39 975 times
Version: 1.1
Category: How-tos

Search method of a model for filters when using dates - unixtimestamp in database

Created 15 years ago by Mukke Mukke, updated 14 years ago by jwerner jwerner.

I ran into a problem and on irc we worked it out. Since there is a lack on information on filters in genral i thought i'd start sharing all my findings, might be usefull for other people.

10 0
11 followers
Viewed: 40 062 times
Version: 1.1
Category: Tips