本文整理汇总了PHP中Department::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::model方法的具体用法?PHP Department::model怎么用?PHP Department::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getShowData
public static function getShowData($data)
{
$data["subject"] = stripslashes($data["subject"]);
if (!empty($data["author"])) {
$data["authorDeptName"] = Department::model()->fetchDeptNameByUid($data["author"]);
}
if ($data["approver"] != 0) {
$data["approver"] = User::model()->fetchRealNameByUid($data["approver"]);
} else {
$data["approver"] = Ibos::lang("None");
}
$data["addtime"] = ConvertUtil::formatDate($data["addtime"], "u");
$data["uptime"] = empty($data["uptime"]) ? "" : ConvertUtil::formatDate($data["uptime"], "u");
$data["categoryName"] = ArticleCategory::model()->fetchCateNameByCatid($data["catid"]);
if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) {
$data["departmentNames"] = Ibos::lang("All");
$data["positionNames"] = $data["uidNames"] = "";
} elseif ($data["deptid"] == "alldept") {
$data["departmentNames"] = Ibos::lang("All");
$data["positionNames"] = $data["uidNames"] = "";
} else {
$department = DepartmentUtil::loadDepartment();
$data["departmentNames"] = ArticleUtil::joinStringByArray($data["deptid"], $department, "deptname", "、");
$position = PositionUtil::loadPosition();
$data["positionNames"] = ArticleUtil::joinStringByArray($data["positionid"], $position, "posname", "、");
if (!empty($data["uid"])) {
$users = User::model()->fetchAllByUids(explode(",", $data["uid"]));
$data["uidNames"] = ArticleUtil::joinStringByArray($data["uid"], $users, "realname", "、");
} else {
$data["uidNames"] = "";
}
}
return $data;
}
示例2: checkReadScope
public static function checkReadScope($uid, $data)
{
if ($data["deptid"] == "alldept") {
return true;
}
if ($uid == $data["author"]) {
return true;
}
if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) {
return true;
}
$user = User::model()->fetch(array("select" => array("deptid", "positionid"), "condition" => "uid=:uid", "params" => array(":uid" => $uid)));
$childDeptid = Department::model()->fetchChildIdByDeptids($data["deptid"]);
if (StringUtil::findIn($user["deptid"], $childDeptid . "," . $data["deptid"])) {
return true;
}
$childCcDeptid = Department::model()->fetchChildIdByDeptids($data["ccdeptid"]);
if (StringUtil::findIn($user["deptid"], $childCcDeptid . "," . $data["ccdeptid"])) {
return true;
}
if (StringUtil::findIn($data["positionid"], $user["positionid"])) {
return true;
}
if (StringUtil::findIn($data["uid"], $uid)) {
return true;
}
if (StringUtil::findIn($data["ccpositionid"], $user["positionid"])) {
return true;
}
if (StringUtil::findIn($data["ccuid"], $uid)) {
return true;
}
return false;
}
示例3: loadModel
public function loadModel($id)
{
if (($model = Department::model()->findByPk($id)) === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
示例4: actionForm
public function actionForm($id = null)
{
if (Yii::app()->session["username"] != null) {
$this->layout = "main";
} else {
$this->layout = "front";
}
$model = new Department();
if (!empty($_POST["Department"])) {
// 1.step new Department
$model = new Department();
// 2.step edit Department
if (!empty($id)) {
$model = Department::model()->findByPk($id);
}
// 3. step merge data
$model->_attributes = $_POST["Department"];
// 6. step save/update
if ($model->save()) {
$this->redirect("index.php?r=department");
}
}
if (!empty($id)) {
$model = Department::model()->findByPk($id);
}
$this->render("//department/form", array("model" => $model));
}
示例5: actionIndex
/**
* Страница "Наша команда"
*/
public function actionIndex()
{
// Загрузка страницы "Наша команда"
Yii::import("application.modules.page.models.Page");
$page = Page::model()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->findByPath("team");
// Загрузка списка отделов с сотрудниками и руководителями
$deparmtents = Department::model()->published()->with(array('chief' => array('scopes' => 'published'), 'employees' => array('scopes' => 'published', 'order' => 'employees.sort ASC')))->findAll(array('order' => 't.sort'));
// Рендер шаблона
$this->render('index', array('deparmtents' => $deparmtents, 'page' => $page));
}
示例6: loadDepartment
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public function loadDepartment($departid)
{
if ($this->_department === null) {
$this->_department = Department::model()->findbyPk($departid);
if ($this->_department === null) {
throw new CHttpException(404, 'The requested Department does not exist.');
}
}
return $this->_department;
}
示例7: getMyFlowIDs
public static function getMyFlowIDs($uid)
{
$flowIDs = $orgIDs = array();
$user = User::model()->fetchByUid($uid);
$allDeptStr = Department::model()->queryDept($user["alldeptid"], true);
$deptArr = DepartmentUtil::loadDepartment();
foreach ($deptArr as $id => $dept) {
if ($dept["pid"] == 0) {
$orgIDs[] = $id;
}
}
$orgIDs = implode(",", $orgIDs);
foreach (FlowPermission::model()->fetchAllByPer() as $val) {
switch ($val["scope"]) {
case "selfdeptall":
case "selfdept":
$deptid = FlowType::model()->fetchDeptIDByFlowID($val["flowid"]);
if ($deptid !== 0 && $user["isadministrator"] != 1) {
if ($val["scope"] == "selfdept") {
$deptAccess = StringUtil::findIn($user["alldeptid"], $val["deptid"]);
$userAccess = WfNewUtil::compareIds($user["uid"], $val["uid"], "u");
$posAccess = WfNewUtil::compareIds($user["allposid"], $val["positionid"], "p");
if ($deptAccess || $userAccess || $posAccess) {
$flowIDs[] = $val["flowid"];
}
} elseif (self::hasAccess($user, $val)) {
$flowIDs[] = $val["flowid"];
}
} else {
$flowIDs[] = $val["flowid"];
}
break;
case "selforg":
if (StringUtil::findIn($allDeptStr, $orgIDs)) {
if (self::hasAccess($user, $val)) {
$flowIDs[] = $val["flowid"];
}
}
break;
case "alldept":
if (self::hasAccess($user, $val)) {
$flowIDs[] = $val["flowid"];
}
break;
default:
if (StringUtil::findIn($allDeptStr, $val["scope"])) {
if (self::hasAccess($user, $val)) {
$flowIDs[] = $val["flowid"];
}
}
break;
}
}
return $flowIDs;
}
示例8: getProcessInfo
public function getProcessInfo()
{
$data = array("name" => $this->name);
$preProcessName = FlowProcess::model()->fetchAllPreProcessName($this->flowid, $this->processid);
foreach ($preProcessName as $key => $value) {
$data["pre"][$key] = $value["name"];
}
if (!empty($this->processto)) {
foreach (explode(",", $this->processto) as $key => $toId) {
$toId = intval($toId);
if ($toId == 0) {
$data["next"][$key] = Ibos::lang("End");
} else {
$next = FlowProcess::model()->fetchProcess($this->flowid, $toId);
$data["next"][$key] = $next["name"];
}
if (isset($next) && !empty($next["processin"])) {
$data["prcsout"][$key]["name"] = $next["name"];
$data["prcsout"][$key]["con"] = $next["processin"];
}
}
}
if (!empty($this->processitem)) {
$itemPart = explode(",", $this->processitem);
$data["processitem"] = $this->processitem;
$data["itemcount"] = count($itemPart);
} else {
$data["processitem"] = "";
$data["itemcount"] = 0;
}
if (!empty($this->hiddenitem)) {
$itemPart = explode(",", $this->hiddenitem);
$data["hiddenitem"] = $this->hiddenitem;
$data["hiddencount"] = count($itemPart);
} else {
$data["hiddenitem"] = "";
$data["hiddencount"] = 0;
}
if (!empty($this->uid)) {
$data["user"] = User::model()->fetchRealnamesByUids($this->uid);
} else {
$data["user"] = "";
}
if (!empty($this->deptid)) {
$data["dept"] = Department::model()->fetchDeptNameByDeptId($this->deptid);
} else {
$data["dept"] = "";
}
if (!empty($this->positionid)) {
$data["position"] = Position::model()->fetchPosNameByPosId($this->positionid);
} else {
$data["position"] = "";
}
return $data;
}
示例9: departmentOptions
static function departmentOptions()
{
$criteria = new CDbCriteria();
$criteria->select = 'department_id, department_name';
$model = Department::model()->findAll();
$departments = array('' => '请选择相应院系');
foreach ($model as $row) {
$departments[$row->department_id] = $row->department_name;
}
return $departments;
}
示例10: duplicatedName
public function duplicatedName($attribute, $params)
{
if ($this->isNewRecord) {
if (count(Department::model()->findALl('name=:name', array("name" => $this->name))) > 0) {
$this->addError($attribute, str_replace("{attribute}", $attribute, Yii::app()->params["templateDuplicatedValueErrorMessage"]));
}
} else {
if (count(Department::model()->findALl('id<> :id and name=:name', array("name" => $this->name, "id" => $this->id))) > 0) {
$this->addError($attribute, str_replace("{attribute}", $attribute, Yii::app()->params["templateDuplicatedValueErrorMessage"]));
}
}
}
示例11: handleDepartment
public function handleDepartment($event)
{
$departments = array();
$records = Department::model()->findAll(array("order" => "sort ASC"));
if (!empty($records)) {
foreach ($records as $record) {
$dept = $record->attributes;
$departments[$dept["deptid"]] = $dept;
}
}
Syscache::model()->modify("department", $departments);
}
示例12: run
public function run()
{
$currentMenuId = Yii::app()->controller->menuId;
$arr[0] = $currentMenuId;
$criteria = new CDbCriteria();
$criteria->order = 'department_id ASC';
$departments = Department::model()->localized()->findAll($criteria);
foreach ($departments as $i => $department) {
$items[$i] = array('label' => $department->title, 'url' => Yii::app()->createUrl('job/index', array('id' => $department->primaryKey)), 'active' => $department->primaryKey == $currentMenuId);
}
//print_r($items);exit;
$this->render('jobSidebar', array('items' => $items));
}
示例13: getProfile
protected function getProfile()
{
$uid = intval(EnvUtil::getRequest("uid"));
$user = User::model()->fetchByUid($uid);
$user["fax"] = "";
if (!empty($user["deptid"])) {
$dept = Department::model()->fetchByPk($user["deptid"]);
$user["fax"] = $dept["fax"];
}
$user["birthday"] = !empty($user["birthday"]) ? date("Y-m-d", $user["birthday"]) : "";
$cuids = Contact::model()->fetchAllConstantByUid(Ibos::app()->user->uid);
$this->ajaxReturn(array("isSuccess" => true, "user" => $user, "uid" => Ibos::app()->user->uid, "cuids" => $cuids));
}
示例14: actionStruct
public function actionStruct()
{
$id = $_POST['type_id'];
$mType = $_POST['mType'];
$products = new Products();
$stuff = new Halfstaff();
$dish = new Dishes();
$prodList = $products->getUseProdList();
$stuffList = $stuff->getUseStuffList();
$dishList = $dish->getUseDishList();
$dishModel = Menu::model()->with('dish')->findAll('t.type_id = :typeId AND mType = :mType', array(':typeId' => $id, ':mType' => $mType));
$prodModel = Menu::model()->with('products')->findAll('t.type_id = :typeId AND mType = :mType', array(':typeId' => $id, ':mType' => $mType));
$stuffModel = Menu::model()->with('halfstuff')->findAll('t.type_id = :typeId AND mType = :mType', array(':typeId' => $id, ':mType' => $mType));
$listDep = CHtml::listData(Department::model()->findAll(), 'department_id', 'name');
$this->renderPartial('struct', array('id' => $id, 'mType' => $mType, 'listDep' => $listDep, 'dishModel' => $dishModel, 'prodModel' => $prodModel, 'stuffModel' => $stuffModel, 'prodList' => $prodList, 'stuffList' => $stuffList, 'dishList' => $dishList));
}
示例15: actionUpdate
public function actionUpdate(){
$id = Yii::app()->request->getParam('id');
$model = Department::model()->findByPk($id);
if(Yii::app()->request->isPostRequest) {
$model->attributes = Yii::app()->request->getPost('Department');
if($model->save()){
Yii::app()->user->setFlash('success' , '修改成功');
$this->redirect(array('department/index' , 'companyId' => $this->companyId));
}
}
$printers = $this->getPrinterList();
$this->render('update' , array(
'model'=>$model,
'printers'=>$printers
));
}