ar_echo(ar_assert(notfound($kids, "'name_first' => 'JAMIE'")) ? "[OK] No JAMIE relation\n" : "[!!] Found relation when I shouldn't\n"); ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); ar_echo("rugrat->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); ar_echo("In rugrat's constructor it is specified that\nit must forget any existing relation\n"); ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); $rugrat = new Rugrat('children'); $rugrats = $rugrat->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); ar_echo(ar_assert(found($rugrats, "'name_first' => 'Jill'")) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); ar_echo(ar_assert(notfound($rugrats, "'favorite_color' => 'lavender'")) ? "[OK] No relation found\n" : "[!!] Found relation when I shouldn't\n"); ar_echo(ar_assert(notfound($rugrats, "'name_first' => 'Joan'")) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); ar_echo(ar_assert(notfound($rugrats, "'name_first' => 'JAMIE'")) ? "[OK] No JAMIE relation\n" : "[!!] Found relation when I shouldn't\n"); ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); ar_echo("kid->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); ar_echo("Note how only rugrat forgot its relations - kid is fine.\n"); ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); $kid = new Kid('children'); $kids = $kid->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); ar_echo(ar_assert(found($kids, "'name_first' => 'Jill'")) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); ar_echo(ar_assert(found($kids, "'favorite_color' => 'lavender'")) ? "[OK] I did not forget relation: person\n" : "[!!] I should not have forgotten relation: person\n"); ar_echo(ar_assert(notfound($kids, "'name_first' => 'Joan'")) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); ar_echo(ar_assert(notfound($kids, "'name_first' => 'JAMIE'")) ? "[OK] No JAMIE relation\n" : "[!!] Found relation when I shouldn't\n"); ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); ar_echo("rugrat->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); $rugrat = new Rugrat('children'); $rugrats = $rugrat->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); $arugrat = $rugrats[0]; ar_echo(ar_assert(found($arugrat, "'name_first' => 'Jill'")) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); ar_echo(ar_assert(notfound($arugrat, "'favorite_color' => 'lavender'")) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); ar_echo("\n-- Loading relations:\n\n"); $arugrat->belongsTo('person');
?> <b>From :</b> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'from_date', 'value' => Yii::app()->request->cookies['from_date']->value, 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('style' => 'height:20px;'))); ?> <b>To :</b> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'to_date', 'value' => Yii::app()->request->cookies['to_date']->value, 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd'), 'htmlOptions' => array('style' => 'height:20px;'))); echo CHtml::submitButton('Go'); $this->endWidget(); ?> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'job-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'image', 'header' => 'Image', 'type' => 'html', 'value' => 'Job::showImage($data->id)', 'filter' => false), title, description, array('name' => 'user_id', 'header' => 'Posted By (Grown Up)', 'type' => 'html', 'value' => 'Job::searchUser($data->user_id)', 'filter' => CHtml::listData(User::getAllUserExceptAdmin(1), 'id', 'name')), array('name' => 'kid_id', 'header' => 'Assigned To (Kid)', 'type' => 'html', 'value' => 'Job::searchKid($data->kid_id)', 'filter' => CHtml::listData(Kid::getAllKidsInDropDown(1), 'id', 'name')), array('name' => 'created_on', 'header' => 'Date Posted', 'type' => 'html', 'filter' => false), array('name' => 'status', 'header' => 'status', 'type' => 'html', 'value' => 'Job::getJobStatus($data->id)', 'filter' => false)))); ?> <script type="text/javascript"> /*<![CDATA[*/ jQuery(function($) { jQuery(".activate").on('click',function(){ jQuery.ajax({ type:'POST', url: 'backend.php?r=rights/user/approve', data : {userid : $(this).attr('data-id') } }).done(function(response){ alert(response);
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return User the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Kid::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $kid = new Kid(); $kid->setName('ドラミ'); $kid->setSex('girl'); echo $kid->showName(); $kid2 = new Kid(); $kid2->setName('ジャイアン'); $kid2->setSex('boy'); echo $kid2->showName(); class Kid { private $name; private $sex; private $age; function __construct() { $this->name = 'Seed'; $this->sex = 'boy'; } public function setName($namae) { $this->name = $namae; } public function getName() { return $this->name; } public function setSex($gender) { return $this->sex = $gender;