コード例 #1
0
ファイル: StaffController.php プロジェクト: rajat19/yii
 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
0
 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
0
 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
0
ファイル: admin.php プロジェクト: schmunk42/yii-sakila-crud
<?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
0
ファイル: admin.php プロジェクト: schmunk42/yii-sakila-crud
<?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 (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; 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
0
ファイル: _form.php プロジェクト: schmunk42/yii-sakila-crud
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
0
ファイル: _search.php プロジェクト: schmunk42/yii-sakila-crud
	<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
0
ファイル: admin.php プロジェクト: schmunk42/yii-sakila-crud
<?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('store-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 (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; 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' => 'store-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('store_id', array('name' => 'manager_staff_id', 'value' => 'GxHtml::valueEx($data->managerStaff)', 'filter' => GxHtml::listDataEx(Staff::model()->findAllAttributes(null, true))), array('name' => 'address_id', 'value' => 'GxHtml::valueEx($data->address)', 'filter' => GxHtml::listDataEx(Address::model()->findAllAttributes(null, true))), 'last_update', array('class' => 'CButtonColumn'))));
コード例 #9
0
ファイル: update.php プロジェクト: schmunk42/yii-sakila-crud
<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))"))));
?>

コード例 #10
0
ファイル: admin.php プロジェクト: schmunk42/yii-sakila-crud
<?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))"))));
コード例 #11
0
ファイル: admin.php プロジェクト: schmunk42/yii-sakila-crud
<?php

$this->breadcrumbs[] = Yii::t('crud', 'Rentals');
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('rental-grid', {\ndata: \$(this).serialize()\n});\nreturn 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));
$this->widget('TbGridView', array('id' => 'rental-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'rental_id', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/rental/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'rental_date', 'editable' => array('url' => $this->createUrl('/sakila/hybrid/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/hybrid/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/hybrid/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))"))));
コード例 #12
0
ファイル: StaffController.php プロジェクト: noikiy/letstravel
	public function actionDel($id)
	{
		$model = Staff::model()->findByPk($id);
		$model->delete();
		$this->redirect(array('list'));
	}
コード例 #13
0
 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));
 }