public function init() { //load module settings $module_d2messages = Yii::app()->getModule('d2messages'); if ($module_d2messages->write) { if (isset($module_d2messages->write['recipient'])) { $this->recipient = $module_d2messages->write['recipient']; } } //load recipient names if ($this->recipient && $this->recipient_names === false) { $this->recipient_names = array(); if (in_array('person_user', $this->recipient)) { $persons = PprsPerson::getPersonsUsers(); foreach ($persons as $row) { $this->recipient_names[] = $row['full_name']; } } if (in_array('roles', $this->recipient)) { $roles = Yii::app()->getModule('user')->UserAdminRoles; $this->recipient_names = array_merge($this->recipient_names, $roles); } } $this->initCss(); $this->initJs(); }
public function init() { $persons = array(); if (in_array('person_user', $this->recipient)) { $persons = PprsPerson::getPersonsUsers(); } $roles = array(); if (in_array('roles', $this->recipient)) { $roles = Yii::app()->getModule('user')->UserAdminRoles; } }
/** * create project * @param array $settings * @return boolean */ public function createProject($settings) { //currently only for persons create project if ($this->model != 'd2person.PprsPerson') { return false; } //validate user roles with setting roles if (isset($settings['user_roles'])) { $user_roles = Authassignment::model()->getUserRoles(Yii::app()->user->id); $a = array_intersect($user_roles, $settings['user_roles']); if (empty($a)) { return false; } } $model = PprsPerson::model()->findByPk($this->model_id); //create project $ttsk = new TtskTask(); $ttsk->ttsk_pprs_id = $this->model_id; $ttsk->ttsk_name = 'New attachment to ' . $model->itemLabel; $ttsk->ttsk_description = ''; $ttsk->ttsk_tstt_id = $settings['new_project_status']; //not started try { if (!$ttsk->save()) { return false; } } catch (Exception $e) { return false; } //create task $tcmn = new TcmnCommunication(); $tcmn->tcmn_ttsk_id = $ttsk->ttsk_id; $tcmn->tcmn_task = 'Validate attachment:' . PHP_EOL; $tcmn->tcmn_task .= $this->file_name . ' ' . $this->add_datetime; $tcmn->tcmn_tcst_id = $settings['task_init_status']; $tcmn->tcmn_datetime = new CDbExpression('ADDDATE(NOW(),' . $settings['task_due_in_days'] . ' )'); try { if (!$tcmn->save()) { return false; } } catch (Exception $e) { return false; } return true; }
<div class="control-group"> <div class='control-label'> <?php echo Chtml::label('Managers', 'managers'); ?> </div> <div class='controls'> <span class="tooltip-wrapper" data-toggle='tooltip' data-placement="right" title='<?php echo ($t = Yii::t('D2tasksModule.model', 'tooltip.ttsk_name')) != 'tooltip.ttsk_name' ? $t : ''; ?> '> <?php $person = PprsPerson::model()->getSysCompanyPersons(); echo Chtml::listBox('managers', Yii::app()->getModule('user')->user()->profile->person_id, CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000, 'order' => 'pprs_second_name')), 'pprs_id', 'itemLabel'), array('style' => 'width:300px;', 'size' => 30, 'multiple' => 'multiple')); ?> </span> </div> </div> <?php ?> <?php ?> <div class="control-group"> <div class='control-label'> <?php echo $form->labelEx($model, 'ttsk_name'); ?>
</div> </div> <?php } ?> <div class="row"> <div class="span4"> <?php $attributes = array('id', 'username'); $profileFields = ProfileField::model()->forOwner()->sort()->findAll(); if ($profileFields) { foreach ($profileFields as $field) { array_push($attributes, array('label' => UserModule::t($field->title), 'name' => $field->varname, 'type' => 'raw', 'value' => $field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname)))); } } $pprs = PprsPerson::model()->findByPk($model->profile->person_id); if ($pprs) { array_push($attributes, 'email', 'create_at', 'lastvisit_at', ['name' => 'status', 'value' => User::itemAlias("UserStatus", $model->status)], ['name' => UserModule::t('Person'), 'type' => 'raw', 'value' => $pprs->itemLabel, 'value_id' => $pprs->pprs_id, 'external_link' => array('/d2person/pprsPerson/view', 'pprs_id' => $pprs->pprs_id), 'external_title' => UserModule::t('Open person data card')]); } $defaultDetailView = Yii::app()->getModule('user')->defaultDetailView; $this->widget($defaultDetailView['path'], $defaultDetailView['options'] + array('data' => $model, 'attributes' => $attributes)); ?> <div class="btn-toolbar pull-left"> <div class="btn-group"><?php echo $cancel_buton; ?> </div> </div> </div> <div class="span5"> <!-- main inputs --> <?php
if (!$ajax) { $this->setPageTitle(Yii::t('D2tasksModule.model', 'Tasks')); Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePicker(id, data) {\n filter_TcmnCommunication_tcmn_date_range_init();\n }\n"); ?> <div class="clearfix"> <div class="btn-toolbar pull-left"> <div class="btn-group"> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('D2tasksModule.crud', 'Create'), 'icon' => 'icon-plus', 'size' => 'large', 'type' => 'success', 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess('D2tasks.TcmnCommunication.*') || Yii::app()->user->checkAccess('D2tasks.TcmnCommunication.Create'))); ?> </div> <div class="btn-group"> <h1> <i class="icon-ticket"></i> <?php echo Yii::t('D2tasksModule.model', 'Tasks'); ?> </h1> </div> </div> </div> <?php Yii::beginProfile('TcmnCommunication.view.grid'); } $this->widget('TbGridView', array('id' => 'tcmn-communication-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{summary}{pager}{items}{pager}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'afterAjaxUpdate' => 'reinstallDatePicker', 'columns' => array(array('header' => Yii::t('D2tasksModule.model', 'Client'), 'value' => '$data->ccmp_name', 'name' => 'tcmn_ttsk_id', 'filter' => CHtml::listData(CcmpCompany::model()->findAll(array('order' => 'ccmp_name')), 'ccmp_id', 'itemLabel')), array('header' => Yii::t('D2tasksModule.model', 'Project'), 'name' => 'task_name', 'value' => '$data->ttsk_name'), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_pprs_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000)), 'pprs_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_client_pprs_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000)), 'pprs_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_task', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('/d2tasks/tcmnCommunication/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_result', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('/d2tasks/tcmnCommunication/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_tcst_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(TcstCommunicationStatus::model()->findAll(array('limit' => 1000)), 'tcst_id', 'itemLabel')), 'filter' => CHtml::listData(TcstCommunicationStatus::model()->findAll(array('limit' => 1000)), 'tcst_id', 'itemLabel')), array('name' => 'tcmn_datetime', 'filter' => $this->widget('vendor.dbrisinajumi.DbrLib.widgets.TbFilterDateRangePicker', array('model' => $model, 'attribute' => 'tcmn_date_range', 'options' => array('ranges' => array('today', 'yesterday', 'this_week', 'last_week', 'this_month', 'last_month', 'this_year'))), TRUE)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_tmed_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(TmedMedia::model()->findAll(array('limit' => 1000)), 'tmed_id', 'itemLabel')), 'filter' => CHtml::listData(TmedMedia::model()->findAll(array('limit' => 1000)), 'tmed_id', 'itemLabel')), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'Yii::app()->user->checkAccess("D2tasks.TcmnCommunication.View")'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'FALSE')), 'viewButtonUrl' => 'Yii::app()->controller->createUrl("ttskTask/view", array("ttsk_id" => $data->tcmn_ttsk_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("tcmn_id" => $data->tcmn_id))', 'deleteConfirmation' => Yii::t('D2tasksModule.crud', 'Do you want to delete this item?'), 'viewButtonOptions' => array('data-toggle' => 'tooltip'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'))))); if (!$ajax) { Yii::endProfile('TcmnCommunication.view.grid'); }
<div class="table-header"> <i class="icon-user"></i> <?php echo Yii::t('D2tasksModule.model', 'Tprs Persons'); ?> <?php if (Yii::app()->user->checkAccess("D2tasks.TprsPersons.Create")) { $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'ajaxButton', 'type' => 'primary', 'size' => 'mini', 'icon' => 'icon-plus', 'url' => array('//d2tasks/tprsPersons/ajaxCreate', 'field' => 'tprs_ttsk_id', 'value' => $modelMain->primaryKey, 'ajax' => 'tprs-persons-grid'), 'ajaxOptions' => array('success' => 'function(html) {$.fn.yiiGridView.update(\'tprs-persons-grid\');}'), 'htmlOptions' => array('title' => Yii::t('D2tasksModule.crud', 'Add new record'), 'data-toggle' => 'tooltip'))); } ?> </div> <?php if (empty($modelMain->tprsPersons)) { $model = new TprsPersons(); $model->tprs_ttsk_id = $modelMain->primaryKey; $model->save(); unset($model); } $model = new TprsPersons(); $model->tprs_ttsk_id = $modelMain->primaryKey; // render grid view $can_edit_tprs = (bool) Yii::app()->user->checkAccess("D2tasks.TprsPersons.Update"); $bft = !$can_edit_tprs ? 'false' : 'true'; $this->widget('TbGridView', array('id' => 'tprs-persons-grid', 'dataProvider' => $model->search(), 'template' => '{summary}{items}', 'summaryText' => ' ', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'tprs_pprs_id', 'value' => '(!' . $bft . ' && !empty($data->tprs_pprs_id))?$data->tprsPprs->itemLabel:""', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2tasks/tprsPersons/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->getSysCompanyPersons(), 'pprs_id', 'itemLabel'), 'apply' => $can_edit_tprs), 'htmlOptions' => array('class' => 'span6')), array('class' => 'editable.EditableColumn', 'name' => 'tprs_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2tasks/tprsPersons/editableSaver'), 'apply' => $can_edit_tprs), 'htmlOptions' => array('class' => 'span12')), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'TRUE')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2tasks/tprsPersons/delete", array("tprs_id" => $data->tprs_id))', 'deleteConfirmation' => Yii::t('D2tasksModule.crud', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'), 'htmlOptions' => array('class' => 'span1'), 'visible' => Yii::app()->user->checkAccess("D2person.TprsPersons.Delete"))))); ?> <?php Yii::endProfile('tprs_ttsk_id.view.grid'); }
</div> <?php } if (!empty($grid_warning)) { ?> <div class="alert alert-warning"><?php echo $grid_warning; ?> </div> <?php } $model = new CcucUserCompany(); $model->ccuc_ccmp_id = $modelMain->primaryKey; // render grid view $can_edit = Yii::app()->user->checkAccess("D2company.CcucUserCompany.Update"); $this->widget('TbGridView', array('id' => 'ccuc-user-company-grid', 'dataProvider' => $model->searchPersonsForRel(), 'template' => '{summary}{items}', 'summaryText' => ' ', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'ccuc_person_id', 'value' => '$data->pprs_second_name . " " . $data->pprs_first_name', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2company/ccucUserCompany/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000)), 'pprs_id', 'itemLabel'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'ccuc_cucp_id', 'value' => '$data->cucp_name', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2company/ccucUserCompany/editableSaver'), 'source' => CHtml::listData(CucpUserCompanyPosition::model()->findAll(array('limit' => 1000)), 'cucp_id', 'itemLabel'), 'apply' => $can_edit)), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'FALSE'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'TRUE')), 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("/d2company/ccucUserCompany/delete", array("ccuc_id" => $data->ccuc_id))', 'deleteConfirmation' => Yii::t('D2companyModule.crud_static', 'Do you want to delete this item?'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'), 'visible' => Yii::app()->user->checkAccess("D2company.CcucUserCompany.Delete"))))); ?> <?php Yii::endProfile('ccuc_ccmp_id.view.grid'); } ?> <?php if ((!$ajax || $ajax == 'ccxg-company-xgroup-grid') && Yii::app()->user->checkAccess("D2company.CcxgCompanyXGroup.View")) { Yii::beginProfile('ccxg_ccmp_id.view.grid'); $grid_error = ''; $grid_warning = ''; if (empty($modelMain->ccxgCompanyXGroups)) { $model = new CcxgCompanyXGroup(); $model->ccxg_ccmp_id = $modelMain->primaryKey;
public static function setRecipientByName($d2mm_id, $recipient) { $roles = Yii::app()->getModule('user')->UserAdminRoles; if (in_array($recipient, $roles)) { self::setRecipientRole($d2mm_id, $recipient); return true; } if ($pprs_id = PprsPerson::getPersonsByFullName($recipient)) { self::setRecipientPerson($d2mm_id, $pprs_id); return true; } }
<?php $this->setPageTitle(Yii::t('D2personModule.model', 'Ppxd Person Xdocuments') . ' - ' . Yii::t('D2personModule.crud_static', 'Manage')); $this->breadcrumbs[] = Yii::t('D2personModule.model', 'Ppxd Person Xdocuments'); Yii::app()->clientScript->registerScript('search', "\n \$('.search-button').click(function () {\n \$('.search-form').toggle();\n\n return false;\n });\n \$('.search-form form').submit(function () {\n \$.fn.yiiGridView.update(\n 'ppxd-person-xdocument-grid',\n {data: \$(this).serialize()}\n );\n\n return false;\n });\n "); ?> <?php $this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs)); ?> <h1> <?php echo Yii::t('D2personModule.model', 'Ppxd Person Xdocuments'); ?> <small><?php echo Yii::t('D2personModule.crud_static', 'Manage'); ?> </small> </h1> <?php $this->renderPartial("_toolbar", array("model" => $model)); Yii::beginProfile('PpxdPersonXDocument.view.grid'); ?> <?php $this->widget('TbGridView', array('id' => 'ppxd-person-xdocument-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{summary}{pager}{items}{pager}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'CLinkColumn', 'header' => '', 'labelExpression' => '$data->itemLabel', 'urlExpression' => 'Yii::app()->controller->createUrl("view", array("ppxd_id" => $data["ppxd_id"]))'), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_id', 'editable' => array('url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_pprs_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000)), 'pprs_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_pdcm_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'), 'source' => CHtml::listData(PdcmDocumentType::model()->findAll(array('limit' => 1000)), 'pdcm_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_number', 'editable' => array('url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_issue_date', 'editable' => array('type' => 'date', 'url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_expire_date', 'editable' => array('type' => 'date', 'url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_notes', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxd_status', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2person/ppxdPersonXDocument/editableSaver'), 'source' => $model->getEnumFieldLabels('ppxd_status')), 'filter' => $model->getEnumFieldLabels('ppxd_status')), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.View")'), 'update' => array('visible' => 'Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.Update")'), 'delete' => array('visible' => 'Yii::app()->user->checkAccess("D2person.PpxdPersonXDocument.Delete")')), 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("ppxd_id" => $data->ppxd_id))', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("ppxd_id" => $data->ppxd_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("ppxd_id" => $data->ppxd_id))')))); Yii::endProfile('PpxdPersonXDocument.view.grid');
$view = Yii::app()->getModule('user')->view . '.profile._view_contacts'; $this->renderPartial($view); ?> </div> </div> <?php } if (Yii::app()->hasModule('d2files')) { ?> <div class="space-12"></div> <div class="row-fluid"> <div class="span7"> <?php $pprs_id = Yii::app()->getModule('user')->user()->profile->person_id; $pprs_model = PprsPerson::model()->findByPk($pprs_id); if (empty($pprs_model)) { ?> <div class="alert alert-warning"> <strong>Warning!</strong> Can not find person data record! </div> <?php } else { $this->widget('d2FilesWidget', array('module' => 'd2person', 'model' => $pprs_model)); } ?> </div> </div> <?php
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $this->layout = ''; $model = new User(); $profile = new Profile(); $this->performAjaxValidation(array($model, $profile)); if (isset($_POST['User'])) { $post_user = $_POST['User']; /** * for customer user * - email is username * - password generated */ if (isset($_POST['user_type']) && $_POST['user_type'] == 'customer') { $post_user['username'] = $post_user['email']; $post_user['password'] = DbrLib::rand_string(8); $post_user['status'] = User::STATUS_ACTIVE; } $model->attributes = $post_user; $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password); $profile->attributes = $_POST['Profile']; $profile->user_id = 0; if ($model->validate() && $profile->validate()) { $model->password = Yii::app()->controller->module->encrypting($model->password); if ($model->save()) { if (Yii::app()->sysCompany->getActiveCompany()) { //create person $model_person = new PprsPerson(); $model_person->pprs_first_name = $profile->first_name; $model_person->pprs_second_name = $profile->last_name; if (isset($post_user['ccmp_id'])) { $model_person->pprs_ccmp_id = $post_user['ccmp_id']; } else { $model_person->pprs_ccmp_id = Yii::app()->sysCompany->getActiveCompany(); } $model_person->save(); } $profile->user_id = $model->id; $profile->person_id = $model_person->primaryKey; $profile->save(); /** * customer user * - add role user customer * - redirect to view */ if (isset($_POST['user_type']) && $_POST['user_type'] == 'customer') { //add role user customer $aa_model = new Authassignment(); $aa_model->itemname = Yii::app()->getModule('user')->customerUser['role']; $aa_model->userid = $model->id; $aa_model->save(); //redirect to view $this->redirect(array('viewCustomer', 'id' => $model->id)); } } $this->redirect(array('view', 'id' => $model->id)); } else { $profile->validate(); } } if (isset($_GET['type']) && $_GET['type'] == 'customer') { $this->menu_route = "user/admin/customerAdmin"; $view = 'create_customer'; } else { $view = 'create'; } if (Yii::app()->getModule('user')->view) { $alt_view = Yii::app()->getModule('user')->view . '.admin.' . $view; if (is_readable(Yii::getPathOfAlias($alt_view) . '.php')) { $view = $alt_view; $this->layout = Yii::app()->getModule('user')->layout; } } $this->render($view, array('model' => $model, 'profile' => $profile)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $this->layout = ''; $model = new User(); $profile = new Profile(); $this->performAjaxValidation(array($model, $profile)); if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->activkey = Yii::app()->controller->module->encrypting(microtime() . $model->password); $profile->attributes = $_POST['Profile']; $profile->user_id = 0; if ($model->validate() && $profile->validate()) { $model->password = Yii::app()->controller->module->encrypting($model->password); if ($model->save()) { if (Yii::app()->sysCompany->getActiveCompany()) { //create person $model_person = new PprsPerson(); $model_person->pprs_first_name = $profile->first_name; $model_person->pprs_second_name = $profile->last_name; $model_person->pprs_ccmp_id = Yii::app()->sysCompany->getActiveCompany(); $model_person->save(); } $profile->user_id = $model->id; $profile->person_id = $model_person->primaryKey; $profile->save(); } $this->redirect(array('view', 'id' => $model->id)); } else { $profile->validate(); } } $view = 'create'; if (Yii::app()->getModule('user')->view) { $alt_view = Yii::app()->getModule('user')->view . '.admin.' . $view; if (is_readable(Yii::getPathOfAlias($alt_view) . '.php')) { $view = $alt_view; $this->layout = Yii::app()->getModule('user')->layout; } } $this->render($view, array('model' => $model, 'profile' => $profile)); }
<div class="row"> <div class="span7"> <!-- main inputs --> <div class="form-horizontal"> <?php $aChecked = array(); // $mCcuc = new CcgrGroup(); foreach ($model->ccucUserCompany as $modelCcuc) { // $mCcgr = $modelCcxg; $aChecked[] = $modelCcuc->ccuc_person_id; } if (count($aChecked) == 1) { //kaut kads gljuks, nedrikst padot masivu ar vienu elementu $aChecked = $aChecked[0]; } //var_dump($aChecked);exit; echo CHtml::checkBoxList('ccuc_person_id', $aChecked, CHtml::listData(PprsPerson::model()->findAll(), 'id', 'fullnameusernameroles')); ?> <?php //echo $form->error($PxpModel, 'ppxt_id'); ?> </div> <?php // } ?> <div class="form-actions"> <?php echo CHtml::resetButton(Yii::t('D2companyModule.crud_static', 'Reset'), array('class' => 'btn')); echo ' ' . CHtml::submitButton(Yii::t('D2companyModule.crud_static', 'Save'), array('class' => 'btn btn-primary', 'name' => 'save_company_manager')); ?>
<?php $title = 'Order ' . $model->number; /** * all company list */ $criteria = new CDBCriteria(); $criteria->order = 't.ccmp_name'; pfOrder::$lists['ccmp'] = CHtml::listData(CcmpCompany::model()->findAll($criteria), 'ccmp_id', 'ccmp_name'); unset($criteria); /** * person list for */ pfOrder::$lists['pprs'] = CHtml::listData(PprsPerson::model()->findAll(), 'pprs_id', 'itemLabel'); /** * order items list */ $criteria = new CDbCriteria(); $criteria->compare('order_id', $model->primaryKey); $orderItems = PfOrderItems::model()->searchClient($criteria)->getData(); unset($criteria); $tableRows = []; /** * for notes filter */ $userPersonId = Yii::app()->getModule('user')->user()->profile->person_id; $header = ['manufakturer_ccmp_id' => 'Manufacturer', 'planed_ready_date' => 'Planed ready date', 'load_meters' => 'Load meters', 'm3' => 'Cubic meters', 'notes' => 'Notes']; foreach ($orderItems as $oi) { $tableRows[] = ['manufakturer_ccmp_id' => pfOrder::$lists['ccmp'][$oi->manufakturer_ccmp_id], 'planed_ready_date' => $oi->planed_ready_date, 'load_meters' => $oi->load_meters, 'm3' => $oi->m3, 'notes' => $oi->notes]; $notesCriteria = new CDbCriteria(); $notesCriteria->condition = "t.from_pprs_id = " . $userPersonId . " OR t.to_pprs_id=" . $userPersonId;
// "confirm" => Yii::t("D2tasksModule.crud", "Do you want to delete this item?") // ), // "visible" => (Yii::app()->request->getParam("ttsk_id")) && (Yii::app()->user->checkAccess("D2tasks.TtskTask.*") || Yii::app()->user->checkAccess("D2tasks.TtskTask.Delete")) // )); ?> </div> </div> </div> <div class="row"> <div class="span4"> <?php $this->widget('TbAceDetailView', array('data' => $model, 'attributes' => array(array('name' => 'ttsk_name', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ttsk_name', 'url' => $this->createUrl('/d2tasks/ttskTask/editableSaver'), 'apply' => $can_edit), true)), array('name' => 'ttsk_ccmp_id', 'type' => 'raw', 'value' => $can_edit ? $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2tasks/ttskTask/editableSaver'), 'source' => CHtml::listData(CcmpCompany::model()->findAll(array('limit' => 1000)), 'ccmp_id', 'itemLabel'), 'attribute' => 'ttsk_ccmp_id'), true) : $model->ttskCcmp->itemLabel, 'value_id' => $model->ttsk_ccmp_id, 'external_link' => array('/d2company/ccmpCompany/updateExtended', 'ccmp_id' => $model->ttsk_ccmp_id), 'external_title' => Yii::t("D2tasksModule.model", 'Show Company Data')), array('name' => 'ttsk_pprs_id', 'type' => 'raw', 'value' => $can_edit ? $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2tasks/ttskTask/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->getSysCompanyPersons(), 'pprs_id', 'itemLabel'), 'attribute' => 'ttsk_pprs_id'), true) : $model->ttskCcmp->itemLabel, 'value_id' => $model->ttsk_pprs_id, 'external_link' => array('/d2person/pprsPerson/view', 'pprs_id' => $model->ttsk_pprs_id), 'external_title' => Yii::t("D2tasksModule.model", 'Show Person Data')), array('name' => 'ttsk_description', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'ttsk_description', 'url' => $this->createUrl('/d2tasks/ttskTask/editableSaver'), 'apply' => $can_edit), true) . ' - '), array('name' => 'ttsk_tstt_id', 'type' => 'raw', 'value' => $can_edit ? $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2tasks/ttskTask/editableSaver'), 'source' => CHtml::listData(TsttStatus::model()->findAll(array('limit' => 1000)), 'tstt_id', 'itemLabel'), 'attribute' => 'ttsk_tstt_id', 'success' => 'function(response, newValue) { $.fn.yiiGridView.update(\'tsth-status-history-grid\'); }'), true) : (!empty($model->ttsk_tstt_id) ? $model->ttskTstt->itemLabel : ' '))))); $this->renderPartial('_tsth_grid', array('model' => $model)); ?> </div> <div class="span8"> <?php $this->renderPartial('_view-relations_grids', array('modelMain' => $model, 'ajax' => false)); ?> </div> </div>
$this->setPageTitle(Yii::t('D2tasksModule.model', 'Projects list')); Yii::app()->clientScript->registerScript('re-install-date-picker', "\n function reinstallDatePicker(id, data) {\n filter_TtskTask_tcmn_date_range_init();\n }\n"); ?> <div class="clearfix"> <div class="btn-toolbar pull-left"> <div class="btn-group"> <?php if (Yii::app()->user->checkAccess('D2tasks.TtskTask.Create')) { $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('D2tasksModule.crud', 'Create'), 'icon' => 'icon-plus', 'size' => 'large', 'type' => 'success', 'url' => array('create'), 'visible' => Yii::app()->user->checkAccess('D2tasks.TtskTask.*') || Yii::app()->user->checkAccess('D2tasks.TtskTask.Create'))); } ?> </div> <div class="btn-group"> <h1> <i class="icon-tasks"></i> <?php echo Yii::t('D2tasksModule.model', 'Projects'); ?> </h1> </div> </div> </div> <?php Yii::beginProfile('TtskTask.view.grid'); } $this->widget('TbGridView', array('id' => 'ttsk-task-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{summary}{pager}{items}{pager}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'afterAjaxUpdate' => 'reinstallDatePicker', 'columns' => array(array('header' => Yii::t('D2tasksModule.model', 'Client'), 'name' => 'ttsk_ccmp_id', 'value' => '$data->ccmp_name', 'filter' => CHtml::listData(CcmpCompany::model()->findAll(array('order' => 'ccmp_name')), 'ccmp_id', 'itemLabel')), array('header' => Yii::t('D2tasksModule.model', 'Persons'), 'name' => 'ttsk_pprs_id', 'value' => '!empty($data->ttskPprs)?$data->ttskPprs->itemLabel:""'), array('name' => 'ttsk_name'), array('name' => 'ttsk_description'), array('name' => 'ttsk_tstt_id', 'value' => '!empty($data->ttskTstt)?$data->ttskTstt->itemLabel:""', 'filter' => CHtml::listData(TsttStatus::model()->findAll(array('limit' => 1000)), 'tstt_id', 'itemLabel')), array('header' => Yii::t('D2tasksModule.model', 'Person'), 'name' => 'person_list', 'value' => '$data->personList', 'filter' => CHtml::listData(PprsPerson::model()->getSysCompanyPersons(), 'pprs_id', 'itemLabel')), array('header' => Yii::t('D2tasksModule.model', 'Communication Plan Date'), 'value' => '$data->minPlanDate', 'filter' => $this->widget('vendor.dbrisinajumi.DbrLib.widgets.TbFilterDateRangePicker', array('model' => $model, 'attribute' => 'tcmn_date_range', 'options' => array('ranges' => array('today', 'yesterday', 'this_week', 'last_week', 'this_month', 'last_month', 'this_year'))), TRUE)), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'Yii::app()->user->checkAccess("D2tasks.TtskTask.View")'), 'update' => array('visible' => 'FALSE'), 'delete' => array('visible' => 'FALSE')), 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("ttsk_id" => $data->ttsk_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("ttsk_id" => $data->ttsk_id))', 'deleteConfirmation' => Yii::t('D2tasksModule.crud', 'Do you want to delete this item?'), 'viewButtonOptions' => array('data-toggle' => 'tooltip'), 'deleteButtonOptions' => array('data-toggle' => 'tooltip'))))); if (!$ajax) { Yii::endProfile('TtskTask.view.grid'); }
<div class="row"> <div class="span12"> <h2> <?php echo Yii::t('D2messagesModule.crud', 'Data'); ?> <small> #<?php echo $model->d2mm_id; ?> </small> </h2> <?php $this->widget('TbDetailView', array('data' => $model, 'attributes' => array(array('name' => 'd2mm_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_id', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_priority', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver'), 'source' => $model->getEnumFieldLabels('d2mm_priority'), 'attribute' => 'd2mm_priority'), true)), array('name' => 'd2mm_status', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver'), 'source' => $model->getEnumFieldLabels('d2mm_status'), 'attribute' => 'd2mm_status'), true)), array('name' => 'd2mm_model', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_model', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_model_record_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_model_record_id', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_sender_pprs_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'type' => 'select', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000)), 'pprs_id', 'itemLabel'), 'attribute' => 'd2mm_sender_pprs_id'), true)), array('name' => 'd2mm_thread_id', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_thread_id', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_read', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_read', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_ds', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_ds', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_created', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_created', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_subject', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_subject', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true)), array('name' => 'd2mm_text', 'type' => 'raw', 'value' => $this->widget('EditableField', array('model' => $model, 'attribute' => 'd2mm_text', 'url' => $this->createUrl('/d2messages/d2mmMessages/editableSaver')), true))))); ?> </div> </div> <div class="row"> <div class="span12"> <?php $this->renderPartial('_view-relations_grids', array('modelMain' => $model, 'ajax' => false)); ?> </div> </div> <?php echo $cancel_buton;
public function loadModel($id) { $m = PprsPerson::model(); // apply scope, if available $scopes = $m->scopes(); if (isset($scopes[$this->scope])) { $m->{$this->scope}(); } $model = $m->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('D2personModule.crud_static', 'The requested page does not exist.')); } return $model; }
<?php $this->setPageTitle(Yii::t('D2personModule.model', 'Ppxt Person Xtypes') . ' - ' . Yii::t('D2personModule.crud_static', 'Manage')); $this->breadcrumbs[] = Yii::t('D2personModule.model', 'Ppxt Person Xtypes'); Yii::app()->clientScript->registerScript('search', "\n \$('.search-button').click(function () {\n \$('.search-form').toggle();\n\n return false;\n });\n \$('.search-form form').submit(function () {\n \$.fn.yiiGridView.update(\n 'ppxt-person-xtype-grid',\n {data: \$(this).serialize()}\n );\n\n return false;\n });\n "); ?> <?php $this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs)); ?> <h1> <?php echo Yii::t('D2personModule.model', 'Ppxt Person Xtypes'); ?> <small><?php echo Yii::t('D2personModule.crud_static', 'Manage'); ?> </small> </h1> <?php $this->renderPartial("_toolbar", array("model" => $model)); Yii::beginProfile('PpxtPersonXType.view.grid'); ?> <?php $this->widget('TbGridView', array('id' => 'ppxt-person-xtype-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{summary}{pager}{items}{pager}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'CLinkColumn', 'header' => '', 'labelExpression' => '$data->itemLabel', 'urlExpression' => 'Yii::app()->controller->createUrl("view", array("ppxt_id" => $data["ppxt_id"]))'), array('class' => 'editable.EditableColumn', 'name' => 'ppxt_id', 'editable' => array('url' => $this->createUrl('/d2person/ppxtPersonXType/editableSaver'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxt_pprs_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2person/ppxtPersonXType/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->findAll(array('limit' => 1000)), 'pprs_id', 'itemLabel'))), array('class' => 'editable.EditableColumn', 'name' => 'ppxt_ptyp_id', 'editable' => array('type' => 'select', 'url' => $this->createUrl('/d2person/ppxtPersonXType/editableSaver'), 'source' => CHtml::listData(PtypType::model()->findAll(array('limit' => 1000)), 'ptyp_id', 'itemLabel'))), array('class' => 'TbButtonColumn', 'buttons' => array('view' => array('visible' => 'Yii::app()->user->checkAccess("D2person.PpxtPersonXType.View")'), 'update' => array('visible' => 'Yii::app()->user->checkAccess("D2person.PpxtPersonXType.Update")'), 'delete' => array('visible' => 'Yii::app()->user->checkAccess("D2person.PpxtPersonXType.Delete")')), 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("ppxt_id" => $data->ppxt_id))', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("ppxt_id" => $data->ppxt_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("ppxt_id" => $data->ppxt_id))')))); Yii::endProfile('PpxtPersonXType.view.grid');
<?php $can_edit = (bool) Yii::app()->user->checkAccess("D2tasks.TcmnCommunication.Update"); $bft = !$can_edit ? 'false' : 'true'; $tcmn_model = new TcmnCommunication(); $tcmn_model->tcmn_ttsk_id = $model->primaryKey; // render grid view $this->widget('TbGridView', array('id' => 'tcmn-communication-grid', 'dataProvider' => $tcmn_model->search(), 'template' => '{summary}{items}', 'rowCssClassExpression' => '$data->tcmnTcst->tcst_css_class', 'summaryText' => ' ', 'htmlOptions' => array('class' => 'rel-grid-view'), 'columns' => array(array('class' => 'editable.EditableColumn', 'name' => 'tcmn_pprs_id', 'value' => !$can_edit ? '!empty($data->tcmn_pprs_id)?$data->tcmnPprs->itemLabel:" - "' : '', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->getSysCompanyPersons(), 'pprs_id', 'itemLabel'), 'placement' => 'right', 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_client_pprs_id', 'value' => !$can_edit ? '!empty($data->tcmn_client_pprs_id)?$data->tcmnClientPprs->itemLabel:" - "' : '', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(PprsPerson::model()->getCompanyPersons($model->ttsk_ccmp_id), 'pprs_id', 'itemLabel'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_task', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_result', 'editable' => array('type' => 'textarea', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_tcst_id', 'value' => '!empty($data->tcmn_tcst_id)?$data->tcmnTcst->itemLabel:" - "', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(TcstCommunicationStatus::model()->findAll(), 'tcst_id', 'itemLabel'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_datetime', 'editable' => array('type' => 'datetime', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'apply' => $can_edit)), array('class' => 'editable.EditableColumn', 'name' => 'tcmn_tmed_id', 'value' => '!empty($data->tcmn_tmed_id)?$data->tcmnTmed->itemLabel:" - "', 'type' => 'raw', 'editable' => array('type' => 'select', 'url' => $this->createUrl('//d2tasks/tcmnCommunication/editableSaver'), 'source' => CHtml::listData(TmedMedia::model()->findAll(array('limit' => 1000)), 'tmed_id', 'itemLabel'), 'apply' => $can_edit)))));
</div> <div class="control-group"> <div class='control-label'> <?php echo $form->labelEx($model, 'tcmn_client_pprs_id'); ?> </div> <div class='controls'> <span class="tooltip-wrapper" data-toggle='tooltip' data-placement="right" title='<?php echo ($t = Yii::t('D2tasksModule.model', 'tooltip.tcmn_client_pprs_id')) != 'tooltip.tcmn_client_pprs_id' ? $t : ''; ?> '> <?php echo $form->dropDownList($model, 'tcmn_client_pprs_id', CHtml::listData(PprsPerson::model()->getCompanyPersons($ttsk_model->ttsk_ccmp_id), 'pprs_id', 'itemLabel'), array('class' => 'span3')); echo $form->error($model, 'tcmn_client_pprs_id'); ?> </span> </div> </div> <div class="control-group"> <div class='control-label'> <?php echo $form->labelEx($model, 'tcmn_tcst_id'); ?> </div> <div class='controls'> <span class="tooltip-wrapper" data-toggle='tooltip' data-placement="right" title='<?php