Showing 661-680 of 827 items.

Configuring controller access rules to default-deny

Created 15 years ago by Steve Friedl Steve Friedl, updated 12 years ago by nsanden nsanden. 3 comments

Starting with the blog tutorial, Yii developers are familiar with the notion of access rules defined in the controller, where the actions are allowed or denied depending on the user's name or role.

class CommentController extends CController {
    public function filters()
    {
        return array( 'accessControl' ); // perform access control for CRUD operations
    }

11 0
12
Viewed: 145 533 times
Version: 1.1
Category: How-tos

Understanding Virtual Attributes and get/set methods

Created 15 years ago by Steve Friedl Steve Friedl, updated 14 years ago by GOsha GOsha. 20 comments

When you define or extend a class, you can create class variables and methods in Yii just like you can in any other PHP system:

class Comment extends CActiveRecord {
    public $helperVariable;
    public function rules() { ... }
    ...
}

and then use them in the obvious way:

$var   = $model->helperVariable;
$rules = $model->rules();

This part everybody understa...

66 0
44
Viewed: 218 507 times
Version: 1.1
Category: Tutorials

CGridView and AjaxForm Connect

Created 15 years ago by PinkBrainPlan PinkBrainPlan, updated 15 years ago by PinkBrainPlan PinkBrainPlan. 2 comments

<?php $this->widget('zii.widgets.grid.CGridView', array(

'dataProvider' => $dataprovider,
'id'=>'recipient_table',
    'selectionChanged'=>'updateEditForm',
'columns' => array(
	'rec_id',
            'org.nachname',
            'org.vorname',
            'org_id',
            array(
                'class'=>'CButtonColumn',
                'template'=>'{...
1 0
10
Viewed: 31 120 times
Version: 1.1
Category: How-tos

URL component access functions

Created 15 years ago by Steve Friedl Steve Friedl, updated 15 years ago by Steve Friedl Steve Friedl. 1 comment

Many applications wish to obtain parts of the URL for the current page (the hostname, the query string, etc.), and the CHttpRequest class wraps various $_SERVER variables to break down the URL into its constituent parts.

28 0
16
Viewed: 22 787 times
Version: 1.1
Category: Tips