本文整理汇总了PHP中Staff::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Staff::model方法的具体用法?PHP Staff::model怎么用?PHP Staff::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Staff
的用法示例。
在下文中一共展示了Staff::model方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
// $this->render('index', array(
// 'staff1' => $this->staff1,
// 'staff2' => $this->staff2,
// 'staff3' => $this->staff3
// ));
$staff_member = Staff::model()->find('id=:id', array(':id' => 1));
$this->render('index', array('staff member' => $staff_member));
}
示例2: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id, $this->modelName);
//$model=$this->loadModel();
$profile = $model->profile;
$gprofile = Profile::model()->with('groups')->findbyPk($model->id);
$profile->group_id = $gprofile->groups;
$this->performAjaxValidation(array($model, $profile), 'staff-form');
if (isset($_POST['Staff'])) {
//$model->attributes=$_POST['Staff'];
$model->status = $_POST['Staff']['status'];
//$profile->attributes=$_POST['Profile'];
$profile->branch_id = $_POST['Profile']['branch_id'];
if ($model->validate() && $profile->validate()) {
$old_password = Staff::model()->notsafe()->findByPk($model->id);
/*if ($old_password->password!=$model->password) {
$model->password=PasswordHelper::hashPassword($model->password);
$model->activkey=PasswordHelper::hashPassword(microtime().$model->password);
}*/
$model->save();
$profile->save();
$criteria = new CDbCriteria();
$criteria->condition = 'profile_id=:profile_id';
$criteria->params = array(':profile_id' => $model->id);
UserGroup::model()->deleteAll($criteria);
if (!empty($_POST['Profile']['group_id'])) {
foreach ($_POST['Profile']['group_id'] as $groupid) {
$userGroup = new UserGroup();
$userGroup->profile_id = $model->id;
$userGroup->group_id = $groupid;
$userGroup->save();
}
}
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
$this->renderPartial('_view', array('model' => $model, 'profile' => $profile), false, true);
Yii::app()->end();
}
$this->redirect(array('view', 'id' => $model->id));
} else {
$profile->validate();
}
}
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
$this->renderPartial('_update', array('model' => $model, 'profile' => $profile), false, true);
Yii::app()->end();
}
$this->render('update', array('model' => $model, 'profile' => $profile));
}
示例3: loadModel
public function loadModel($id)
{
$model = Staff::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, Yii::t('crud', 'The requested page does not exist.'));
}
return $model;
}
示例4: array
<?php
$this->breadcrumbs[] = Yii::t('crud', 'Rentals');
Yii::app()->clientScript->registerScript('search', "\n \$('.search-button').click(function(){\n \$('.search-form').toggle();\n return false;\n });\n \$('.search-form form').submit(function(){\n \$.fn.yiiGridView.update(\n 'rental-grid',\n {data: \$(this).serialize()}\n );\n return false;\n });\n ");
?>
<?php
$this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs));
?>
<h1>
<?php
echo Yii::t('crud', 'Rentals');
?>
<small><?php
echo Yii::t('crud', 'Manage');
?>
</small>
</h1>
<?php
$this->renderPartial("_toolbar", array("model" => $model));
?>
<?php
$this->widget('TbGridView', array('id' => 'rental-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{pager}{items}{pager}{summary}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'CLinkColumn', 'header' => '', 'labelExpression' => '$data->itemLabel', 'urlExpression' => 'Yii::app()->controller->createUrl("view", array("rental_id" => $data["rental_id"]))'), array('class' => 'editable.EditableColumn', 'name' => 'rental_id', 'editable' => array('url' => $this->createUrl('/sakila/slim/rental/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'rental_date', 'editable' => array('url' => $this->createUrl('/sakila/slim/rental/editableSaver'))), array('name' => 'inventory_id', 'value' => 'CHtml::value($data,\'inventory.itemLabel\')', 'filter' => CHtml::listData(Inventory::model()->findAll(array('limit' => 1000)), 'inventory_id', 'itemLabel')), array('name' => 'customer_id', 'value' => 'CHtml::value($data,\'customer.itemLabel\')', 'filter' => CHtml::listData(Customer::model()->findAll(array('limit' => 1000)), 'customer_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'return_date', 'editable' => array('url' => $this->createUrl('/sakila/slim/rental/editableSaver'))), array('name' => 'staff_id', 'value' => 'CHtml::value($data,\'staff.itemLabel\')', 'filter' => CHtml::listData(Staff::model()->findAll(array('limit' => 1000)), 'staff_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'last_update', 'editable' => array('url' => $this->createUrl('/sakila/slim/rental/editableSaver'))), array('class' => 'TbButtonColumn', 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("rental_id" => $data->rental_id))', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("rental_id" => $data->rental_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("rental_id" => $data->rental_id))'))));
示例5: array
<?php
$this->breadcrumbs = array($model->label(2) => array('index'), 'Manage');
$this->menu = array(array('label' => 'List' . ' ' . $model->label(2), 'url' => array('index')), array('label' => 'Create' . ' ' . $model->label(), 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('rental-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
<h1><?php
echo 'Manage' . ' ' . GxHtml::encode($model->label(2));
?>
</h1>
<p>
You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<?php
echo GxHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>
<div class="search-form">
<?php
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<?php
$this->widget('zii.widgets.grid.CGridView', array('id' => 'rental-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('rental_id', 'rental_date', array('name' => 'inventory_id', 'value' => 'GxHtml::valueEx($data->inventory)', 'filter' => GxHtml::listDataEx(Inventory::model()->findAllAttributes(null, true))), array('name' => 'customer_id', 'value' => 'GxHtml::valueEx($data->customer)', 'filter' => GxHtml::listDataEx(Customer::model()->findAllAttributes(null, true))), 'return_date', array('name' => 'staff_id', 'value' => 'GxHtml::valueEx($data->staff)', 'filter' => GxHtml::listDataEx(Staff::model()->findAllAttributes(null, true))), array('class' => 'CButtonColumn'))));
示例6:
echo $form->error($model, 'last_update');
?>
</div><!-- row -->
<label><?php
echo GxHtml::encode($model->getRelationLabel('customers'));
?>
</label>
<?php
echo $form->checkBoxList($model, 'customers', GxHtml::encodeEx(GxHtml::listDataEx(Customer::model()->findAllAttributes(null, true)), false, true));
?>
<label><?php
echo GxHtml::encode($model->getRelationLabel('staffs'));
?>
</label>
<?php
echo $form->checkBoxList($model, 'staffs', GxHtml::encodeEx(GxHtml::listDataEx(Staff::model()->findAllAttributes(null, true)), false, true));
?>
<label><?php
echo GxHtml::encode($model->getRelationLabel('stores'));
?>
</label>
<?php
echo $form->checkBoxList($model, 'stores', GxHtml::encodeEx(GxHtml::listDataEx(Store::model()->findAllAttributes(null, true)), false, true));
?>
<?php
echo GxHtml::submitButton('Save');
$this->endWidget();
?>
</div><!-- form -->
示例7: array
<div class="row">
<?php
echo $form->label($model, 'return_date');
?>
<?php
echo $form->textField($model, 'return_date');
?>
</div>
<div class="row">
<?php
echo $form->label($model, 'staff_id');
?>
<?php
echo $form->dropDownList($model, 'staff_id', GxHtml::listDataEx(Staff::model()->findAllAttributes(null, true)), array('prompt' => 'All'));
?>
</div>
<div class="row">
<?php
echo $form->label($model, 'last_update');
?>
<?php
echo $form->textField($model, 'last_update');
?>
</div>
<div class="row buttons">
<?php
echo GxHtml::submitButton('Search');
示例8: array
<h2>
<?php echo Yii::t('crud','Editable Detail View')?></h2>
<?php
$this->widget('EditableDetailView', array(
'data' => $model,
'url' => $this->createUrl('editableSaver'),
));
?>
*/
?>
<h2>
<?php
echo Yii::t('crud', 'Payments');
?>
</h2>
<div class="btn-group">
<?php
$this->widget('bootstrap.widgets.TbButtonGroup', array('type' => '', 'buttons' => array()));
?>
</div>
<?php
$relatedSearchModel = $model->getRelatedSearchModel('payments');
$this->widget('TbGridView', array('id' => '/sakila/hybrid/payment-grid', 'dataProvider' => $relatedSearchModel->search(), 'filter' => count($model->payments) > 1 ? $relatedSearchModel : null, 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array('payment_id', array('name' => 'customer_id', 'value' => 'CHtml::value($data,\'customer.itemLabel\')', 'filter' => CHtml::listData(Customer::model()->findAll(array('limit' => 1000)), 'customer_id', 'itemLabel')), array('name' => 'staff_id', 'value' => 'CHtml::value($data,\'staff.itemLabel\')', 'filter' => CHtml::listData(Staff::model()->findAll(array('limit' => 1000)), 'staff_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'amount', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/rental/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'payment_date', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/rental/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'last_update', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/rental/editableSaver'))), array('class' => 'TbButtonColumn', 'viewButtonUrl' => "Yii::app()->controller->createUrl('/sakila/hybrid/payment/view', array('payment_id' => \$data->payment_id))", 'updateButtonUrl' => "Yii::app()->controller->createUrl('/sakila/hybrid/payment/update', array('payment_id' => \$data->payment_id))", 'deleteButtonUrl' => "Yii::app()->controller->createUrl('/sakila/hybrid/payment/delete', array('payment_id' => \$data->payment_id))"))));
?>
示例9: array
<?php
$this->breadcrumbs[] = Yii::t('crud', 'Stores');
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\$('.search-form').toggle();\nreturn false;\n});\n\$('.search-form form').submit(function(){\n\$.fn.yiiGridView.update('store-grid', {\ndata: \$(this).serialize()\n});\nreturn false;\n});\n");
?>
<?php
$this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs));
?>
<h1>
<?php
echo Yii::t('crud', 'Stores');
?>
<small><?php
echo Yii::t('crud', 'Manage');
?>
</small>
</h1>
<?php
$this->renderPartial("_toolbar", array("model" => $model));
$this->widget('TbGridView', array('id' => 'store-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'store_id', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/store/editableSaver'))), array('name' => 'manager_staff_id', 'value' => 'CHtml::value($data,\'managerStaff.itemLabel\')', 'filter' => CHtml::listData(Staff::model()->findAll(array('limit' => 1000)), 'staff_id', 'itemLabel')), array('name' => 'address_id', 'value' => 'CHtml::value($data,\'address.itemLabel\')', 'filter' => CHtml::listData(Address::model()->findAll(array('limit' => 1000)), 'address_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'last_update', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/store/editableSaver'))), array('class' => 'TbButtonColumn', 'viewButtonUrl' => "Yii::app()->controller->createUrl('view', array('store_id' => \$data->store_id))", 'updateButtonUrl' => "Yii::app()->controller->createUrl('update', array('store_id' => \$data->store_id))", 'deleteButtonUrl' => "Yii::app()->controller->createUrl('delete', array('store_id' => \$data->store_id))"))));
示例10: actionDel
public function actionDel($id)
{
$model = Staff::model()->findByPk($id);
$model->delete();
$this->redirect(array('list'));
}
示例11: actionIndex
public function actionIndex()
{
$this->hasPrivilege(Acl::ACTION_VIEW);
$this->pageTitle = Lang::t(Common::pluralize($this->resourceAddLabel));
$searchModel = Staff::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], '');
$this->render('index', array('model' => $searchModel));
}