当前位置: 首页>>代码示例>>PHP>>正文


PHP Dept::model方法代码示例

本文整理汇总了PHP中Dept::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Dept::model方法的具体用法?PHP Dept::model怎么用?PHP Dept::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dept的用法示例。


在下文中一共展示了Dept::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $dept_id = $this->user !== NULL ? Users::model()->getDeptId($this->user->id) : NULL;
     if ($this->user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if ($this->user->validatePassword($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($this->user->status === Users::STATUS_BLOCKED) {
                 $this->errorCode = self::ERROR_ACC_BLOCKED;
             } else {
                 if ($this->user->status === Users::STATUS_PENDING) {
                     $this->errorCode = self::ERROR_ACC_PENDING;
                 } else {
                     if (!empty($dept_id) && Dept::model()->get($dept_id, 'status') === Dept::STATUS_CLOSED) {
                         $this->errorCode = self::ERROR_DEPT_CLOSED;
                     } else {
                         $this->completeLogin($dept_id);
                     }
                 }
             }
         }
     }
     return $this->errorCode === self::ERROR_NONE;
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:34,代码来源:UserIdentity.php

示例2: actionIndex

 public function actionIndex()
 {
     $this->hasPrivilege(Acl::ACTION_VIEW);
     $this->pageTitle = Lang::t(Common::pluralize($this->resourceLabel));
     $searchModel = Dept::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'name');
     $this->render('default/index', array('model' => $searchModel));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:7,代码来源:DeptController.php

示例3: actionDelete

 public function actionDelete($id)
 {
     $this->hasPrivilege(Acl::ACTION_DELETE);
     Dept::model()->loadModel($id)->delete();
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
     }
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:8,代码来源:DefaultController.php

示例4: actionDynamicRows

 public function actionDynamicRows()
 {
     $selectionid = $_POST['selection'];
     $depts = Dept::model()->findAllByAttributes(array('orgid' => $selectionid));
     foreach ($depts as $row) {
         $dataOptions[$row->id] = $row->name;
     }
     foreach ($dataOptions as $value => $name) {
         $opt = array();
         $opt['value'] = $value;
         echo CHtml::tag('option', $opt, CHtml::encode($name), true);
     }
     die;
 }
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:14,代码来源:UserController.php

示例5: actionGetDeptInfo

 public function actionGetDeptInfo()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $faculty_id = $request->getPost('faculty_id');
             $dept_id = $request->getPost('dept_id');
             $dept_data = Dept::model()->findAllByAttributes(array('dept_id' => $dept_id, 'dept_faculty' => $faculty_id));
             $this->retVal->dept_data = $dept_data;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:17,代码来源:TrainingProgramController.php

示例6: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($dept_id = NULL, $user_level = NULL)
 {
     $this->hasPrivilege(Acl::ACTION_CREATE);
     $this->pageTitle = Lang::t('Add ' . $this->resourceLabel);
     //account information
     $user_model = new Users(ActiveRecord::SCENARIO_CREATE);
     $user_model->status = Users::STATUS_ACTIVE;
     $user_model_class_name = $user_model->getClassName();
     //personal information
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         $user_model->attributes = $_POST[$user_model_class_name];
         $person_model->attributes = $_POST[$person_model_class_name];
         $user_model->validate();
         $person_model->validate();
         if (!$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $user_model->updateDeptUser();
                 if (!empty($user_model->dept_id)) {
                     Dept::model()->updateContactPerson($user_model->dept_id, $person_model->id);
                 }
                 Yii::app()->user->setFlash('success', Lang::t('SUCCESS_MESSAGE'));
                 $this->redirect(Controller::getReturnUrl($this->createUrl('view', array('id' => $user_model->id))));
             }
         }
     }
     $user_model->timezone = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_DEFAULT_TIMEZONE, SettingsTimezone::DEFAULT_TIME_ZONE);
     if (!empty($dept_id)) {
         $user_model->dept_id = $dept_id;
     }
     if (!empty($user_level)) {
         $user_model->user_level = $user_level;
     }
     $this->render('create', array('user_model' => $user_model, 'person_model' => $person_model));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:42,代码来源:DefaultController.php

示例7: floor

if (trim($labelParams['fileType']) != '') {
    $fileType = $labelParams['fileType'];
    $filetypeRow = FileType::model()->findByAttributes(array('id' => $fileType));
} else {
    $filetypeRow['label_width'] = 400;
    $filetypeRow['label_height'] = 100;
}
$label_width = (int) $filetypeRow['label_width'] . 'px';
$label_height = (int) $filetypeRow['label_height'] . 'px';
$paper = $labelParams['paper'];
$numColumns = floor($paperWidth / $filetypeRow['label_width']);
$connection = Yii::app()->db;
if (trim($labelParams['depts']) == '') {
    $sql = "select CODE,TITLE from fopen";
} else {
    $deptRow = Dept::model()->find('id=:id', array(':id' => $labelParams['depts']));
    $deptName = $deptRow['name'];
    /* Which all Files??*/
    if (isset($labelParams['fileNames'])) {
        $fileIDsText = implode(',', $labelParams['fileNames']);
        $sql = "select CODE,TITLE from fopen where ID IN ({$fileIDsText})";
    } else {
        if (!isset($labelParams['fileNames'])) {
            $sql = "select CODE,TITLE from fopen where DEPARTMENT='" . $deptName . "'";
        }
    }
}
$command = $connection->createCommand($sql);
$dataReader = $command->queryAll();
echo "<table>";
$numRows = ceil(count($dataReader) / $numColumns);
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:31,代码来源:_showlabel.php

示例8: afterSave

 public function afterSave()
 {
     if ($this->scenario === self::SCENARIO_UPDATE) {
         $this->updateDeptUser();
         Dept::model()->updateContactPerson($this->dept_id, $this->id);
     }
     return parent::afterSave();
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:8,代码来源:Users.php

示例9: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex($dept_id = NULL)
 {
     $this->hasPrivilege(Acl::ACTION_VIEW);
     $this->pageTitle = Lang::t(Common::pluralize($this->resourceLabel));
     $dept_model = NULL;
     if (!empty($dept_id)) {
         $dept_model = Dept::model()->loadModel($dept_id);
         $this->pageDescription = $this->pageTitle;
         $this->pageTitle = $dept_model->name;
         $this->activeTab = 7;
     }
     if (!empty(Controller::$dept_id)) {
         $dept_id = Controller::$dept_id;
     }
     $searchModel = UsersView::model()->searchModel(array('dept_id' => $dept_id), $this->settings[Constants::KEY_PAGINATION], 'username', Users::model()->getFetchCondition());
     $this->render('index', array('model' => $searchModel, 'dept_model' => $dept_model));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:20,代码来源:DefaultController.php

示例10: array

    <tr><td>
<?php 
$this->widget('ext.DetailView4Col', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('name', 'password', 'organisation_id', 'pw_md5', 'email', 'phone', 'phones', 'mobile', 'fn', 'ln', 'active', 'id_auth', 'auth_method', 'last_login', 'date_mod', 'designation')));
?>
        </td>
        <td>
<?php 
$grps = Usergroup::model()->findAllByAttributes(array('uid' => $model->id));
$depts = Userdept::model()->findAllByAttributes(array('uid' => $model->id));
echo "<table class='table table-bordered'>";
if (count($depts) == 0) {
    echo "<tr style='background:#F7819F;color:white'><td>{$model->name} doesn't belong to any department</td></tr>";
} else {
    echo "<tr style='background:#F5A9A9;'><th colspan='2'>Departments</th></tr>";
    foreach ($depts as $d) {
        $department = Dept::model()->findByAttributes(array('id' => $d['dept_id']));
        $deptName = $department['name'];
        echo "<tr><td colspan='2'>{$deptName}</td></tr>";
    }
}
if (count($grps) == 0) {
    echo "<tr style='background:#F7819F;color:white'><td>{$model->name} doesn't belong to any group</td></tr>";
} else {
    echo "<tr style='background:#F5A9A9;'><th colspan='2'>Groups</th></tr>";
    foreach ($grps as $g) {
        $group = Group::model()->findByAttributes(array('id' => $g['gid']));
        $groupName = $group['name'];
        echo "<tr><td colspan='2'>{$groupName}</td></tr>";
    }
}
echo "</table>";
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:31,代码来源:view.php

示例11: array

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>
        <?php 
if (isset($_GET['owner'])) {
    $owner = $_GET['owner'];
    $ownerRow = User::model()->findByAttributes(array('name' => $owner));
    $ownerId = $ownerRow['id'];
} else {
    $ownerId = '';
}
if (isset($_GET['deptName'])) {
    $deptName = $_GET['deptName'];
    $deptRow = Dept::model()->findByAttributes(array('name' => $deptName));
    $deptId = $deptRow['id'];
} else {
    $deptId = '';
}
$validUsersIdRows = Userdept::model()->findAll('dept_id =:dept_id AND uid !=:uid', array('dept_id' => $deptId, 'uid' => $ownerId));
$transferTo = [];
foreach ($validUsersIdRows as $user) {
    $u = User::model()->findByPk($user['uid']);
    $transferTo[$u['id']] = $u['name'];
}
?>
   
    
    
	<table>
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:31,代码来源:_form.php

示例12: array

    <div class="panel-heading">
        <h4 class="panel-title">
            <i class="fa fa-chevron-down"></i> <a data-toggle="collapse" data-parent="#accordion" href="#account_info"><?php 
echo Lang::t('Account Details');
?>
</a>
            <?php 
if ($can_update || Users::isMyAccount($model->id)) {
    ?>
                <span><a class="pull-right" href="<?php 
    echo $this->createUrl('view', array('id' => $model->id, 'action' => Users::ACTION_UPDATE_ACCOUNT));
    ?>
"><i class="fa fa-edit"></i> <?php 
    echo Lang::t('Edit');
    ?>
</a></span>
            <?php 
}
?>
        </h4>
    </div>
    <div id="account_info" class="panel-collapse collapse in">
        <div class="panel-body">
            <div class="detail-view">
                <?php 
$this->widget('application.components.widgets.DetailView', array('data' => $model, 'attributes' => array(array('name' => 'id'), array('label' => Lang::t('Department'), 'visible' => !empty($model->dept_id), 'value' => CHtml::link(CHtml::encode(Dept::model()->get($model->dept_id, "name")), Yii::app()->createUrl('dept/default/view', array('id' => $model->dept_id)), array()), 'type' => 'raw'), array('name' => 'status', 'value' => CHtml::tag('span', array('class' => $model->status === Users::STATUS_ACTIVE ? 'badge badge-success' : 'badge badge-danger'), $model->status), 'type' => 'raw'), array('name' => 'username'), array('name' => 'email'), array('name' => 'user_level'), array('name' => 'role_id', 'visible' => !empty($model->role_id), 'value' => UserRoles::model()->get($model->role_id, 'name')), array('name' => 'timezone'), array('name' => 'date_created', 'value' => MyYiiUtils::formatDate($model->date_created)), array('name' => 'created_by', 'value' => Users::model()->get($model->created_by, "username"), 'visible' => !empty($model->created_by)), array('name' => 'last_modified', 'value' => MyYiiUtils::formatDate($model->last_modified), 'visible' => !empty($model->last_modified)), array('name' => 'last_modified_by', 'value' => Users::model()->get($model->last_modified_by, "username"), 'visible' => !empty($model->last_modified_by)), array('name' => 'last_login', 'value' => MyYiiUtils::formatDate($model->last_login)))));
?>
            </div>
        </div>
    </div>
</div>
开发者ID:wanyos2005,项目名称:hsbf,代码行数:31,代码来源:_view_account.php

示例13: array

<?php

return array("fields" => array("doc_id" => array("label" => "Doc ID"), "doc_path" => array("label" => "File", "type" => "_document", "modelFile" => "doc_path_file"), "doc_url" => array("label" => "Preview", "type" => "_image"), "doc_name" => array("label" => "Doc Name"), "doc_description" => array("label" => "Doc Description", "type" => "_textarea"), "doc_author_name" => array("label" => "User upload"), "subject_dept" => array("label" => "Department", "type" => "_dropdown", "_list" => array("primary" => "dept_id", "displayAttr" => "dept_name", "src" => function () {
    $rows = Dept::model()->findAll();
    return $rows;
})), "subject_doc" => array("label" => "Subject", "type" => "_dropdown", "_list" => array("primary" => "subject_id", "displayAttr" => "subject_name", "src" => function () {
    $rows = Subject::model()->findAll();
    return $rows;
})), "subject_faculty" => array("label" => "Faculty", "type" => "_dropdown", "_list" => array("primary" => "faculty_id", "displayAttr" => "faculty_name", "src" => function () {
    $rows = Faculty::model()->findAll();
    return $rows;
})), "subject_type" => array("label" => "Subject Type", "type" => "_dropdown", "_list" => array("primary" => "id", "displayAttr" => "subject_type_name", "src" => function () {
    $rows = SubjectType::model()->findAll();
    return $rows;
})), "doc_dept_name" => array("label" => "Department", "src" => "dept.dept_name")), "columns" => array("doc_id", "doc_url", "doc_name", "doc_description", "doc_author_name", "subject_faculty", "doc_dept_name", "doc_path"), "actions" => array("_view" => true, "_edit" => array("doc_name", "doc_description", "doc_author_name", "subject_dept", "subject_faculty", "subject_type"), "_delete" => true, "_new" => array("type" => "popup", "attr" => array("doc_name", "doc_description", "doc_path", "subject_doc"), "extend" => array("doc_author" => Util::param("ADMIN_ID"), "doc_author_name" => "Admin")), "_search" => array("doc_id", "doc_name"), "_search_advanced" => array("doc_author_name", "subject_dept", "subject_faculty", "doc_name"), "_customButtons" => array()), "default" => array("orderBy" => "doc_id", "orderType" => "desc", "page" => 1, "per_page" => 10, "search" => "", "search_advanced" => ""), "join" => array("dept" => array("table" => "select dept_id, dept_name from tbl_dept", "type" => "left join", "selected_properties" => array("dept_name" => "doc_dept_name"), "on" => array("dept_id" => "t.subject_dept"))), "tableAlias" => "document", "title" => "Document Manager", "condition" => false, "limit_values" => array(10, 20, 30, 40), "model" => "Doc", "primary" => "doc_id", "itemLabel" => "Document", "additionalFiles" => array(), "insertScenario" => "fromAdmin", "updateScenario" => "fromAdmin", "formUpload" => TRUE);
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:15,代码来源:document.php

示例14: actionListOfSubjectInfo

 public function actionListOfSubjectInfo()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $listSubjectData = array('subject_dept' => StringHelper::filterString($_POST['subject_dept']), 'subject_faculty' => StringHelper::filterString($_POST['subject_faculty']), 'subject_type' => StringHelper::filterString($_POST['subject_type']), 'dept_id' => StringHelper::filterString($_POST['subject_dept']), 'faculty_id' => StringHelper::filterString($_POST['subject_faculty']));
             $subject_data = Subject::model()->findAll(array('select' => '*', 'condition' => 'subject_faculty = ' . $listSubjectData['subject_faculty'] . ' AND subject_type = ' . $listSubjectData['subject_type'] . ' AND (subject_general_faculty_id = ' . $listSubjectData['faculty_id'] . ' OR subject_dept = ' . $listSubjectData['subject_dept'] . ')'));
             $subject_type_group = SubjectGroupType::model()->findAllByAttributes(array('subject_group' => $listSubjectData['subject_type'], 'subject_dept' => $listSubjectData['subject_dept'], 'subject_faculty' => $listSubjectData['subject_faculty']));
             //                var_dump($subject_data);
             //                                exit();
             $subject_type_name = SubjectType::model()->findAllByAttributes(array('id' => $listSubjectData['subject_type']));
             $this->retVal->subject_data = $subject_data;
             $this->retVal->subject_group_type = $subject_type_group;
             $dept_data = Dept::model()->findAllByAttributes(array('dept_id' => $listSubjectData['dept_id'], 'dept_faculty' => $listSubjectData['faculty_id']));
             $this->retVal->subject_type = $subject_type_name;
             $this->retVal->message = 1;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:24,代码来源:ListOfSubjectController.php

示例15: actionListTeacherDeptFaculty

 public function actionListTeacherDeptFaculty()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $listSubjectData = array('dept_id' => StringHelper::filterString($_POST['dept_id']), 'faculty_id' => StringHelper::filterString($_POST['faculty_id']));
             $dept_data = Dept::model()->findAllByAttributes(array('dept_id' => $listSubjectData['dept_id']));
             $teacher_data = Teacher::model()->findAllByAttributes(array('teacher_dept' => $listSubjectData['dept_id'], 'teacher_faculty' => $listSubjectData['faculty_id']));
             $this->retVal->teacher_data = $teacher_data;
             $this->retVal->dept_data = $dept_data;
             $this->retVal->message = 1;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:19,代码来源:ShareController.php


注:本文中的Dept::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。