本文整理匯總了PHP中Position::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP Position::model方法的具體用法?PHP Position::model怎麽用?PHP Position::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Position
的用法示例。
在下文中一共展示了Position::model方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadModel
public function loadModel($id)
{
$model = Position::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例2: 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;
}
示例3: gavno
protected function gavno()
{
$position = [];
$list = \Schedule::model()->findAllBySql('select * from spbp_listner_schedule a
join spbp_listner_position b on a.position_id = b.id
join spbp_form_form c on b.form_id = c.id
where a.number = c.number AND a.end_time < now() AND b.status = 1');
foreach ($list as $value) {
$a = \Position::model()->findByPk($value->position_id);
array_push($position, $a);
}
return $position;
}
示例4: fetchAllListByFlowId
public function fetchAllListByFlowId($flowId)
{
$list = $this->fetchAllByFlowId($flowId);
foreach ($list as &$per) {
$per["userName"] = !empty($per["uid"]) ? User::model()->fetchRealnamesByUids($per["uid"]) : "";
if (!empty($per["deptid"])) {
if ($per["deptid"] == "alldept") {
$per["deptName"] = "全體部門";
} else {
$per["deptName"] = Department::model()->fetchDeptNameByDeptId($per["deptid"]);
}
} else {
$per["deptName"] = "";
}
$per["posName"] = !empty($per["positionid"]) ? Position::model()->fetchPosNameByPosId($per["positionid"]) : "";
$per["typeName"] = Ibos::lang($this->_typeLangMap[$per["type"]], "workflow.default");
if (array_key_exists($per["scope"], $this->_scopeLangMap)) {
$per["scopeName"] = Ibos::lang($this->_scopeLangMap[$per["scope"]], "workflow.default");
} else {
$per["scopeName"] = Department::model()->fetchDeptNameByDeptId($per["scope"]);
}
}
return $list;
}
示例5: actionGetSchedules
public function actionGetSchedules($param1, $param2)
{
$startTime = date('Y-m-d', strtotime($_GET['start']));
$endTime = date('Y-m-d', strtotime("+1 week", strtotime($startTime)));
$arr = [];
$arrs = [];
/* if ($param1 == "1") {
$array = \Yii::app()->db->createCommand()
->select('b.id, c.code, z.lastname, b.start_time, b.end_time, b.room_id, d.name,d.color,asd.name as pizda')
->from('spbp_user_user a')
->join('spbp_user_teacher f','a.id = f.user_id')
->join('spbp_listner_position c', 'c.teacher_id = f.id')
->join('spbp_listner_schedule b', 'c.id = b.position_id')
->join('spbp_listner_listner z','z.id = c.listner_id')
->join('spbp_subject_subject d', 'd.id = c.subject_id')
->join('spbp_listner_group asd', 'asd.id = b.group_id')
->where('f.id =:id',array(":id"=>$param2))
->queryAll();
}else if($param1=="2"){
$array = \Yii::app()->db->createCommand()
->select('b.id, c.code, a.last_name as lastname, b.start_time, b.end_time, b.room_id, d.name,d.color,asd.name as pizda')
->from('spbp_user_user a')
->join('spbp_user_teacher f','a.id = f.user_id')
->join('spbp_listner_position c', 'c.teacher_id = f.id')
->join('spbp_listner_schedule b', 'c.id = b.position_id')
->join('spbp_subject_subject d', 'd.id = c.subject_id')
->join('spbp_listner_group asd', 'asd.id = b.group_id')
->where('a.id =:id',array(":id"=>$param2))
->queryAll();
}else if(($param1==0)&&($param2==0)){
$array = \Yii::app()->db->createCommand()
->select('b.id, c.code, concat(a.last_name," - ",z.lastname) as lastname, b.start_time, b.end_time, b.room_id, d.name,d.color, asd.name as pizda')
->from('spbp_user_user a')
->join('spbp_user_teacher f','a.id = f.user_id')
->join('spbp_listner_position c', 'c.teacher_id = f.id')
->join('spbp_listner_listner z','z.id = c.listner_id')
->join('spbp_listner_schedule b', 'c.id = b.position_id')
->join('spbp_subject_subject d', 'd.id = c.subject_id')
->join('spbp_listner_group asd', 'asd.id = b.group_id')
->queryAll();
}*/
$schdls = \Schedule::model()->findAll("start_time between '{$startTime}' and '{$endTime}'");
foreach ($schdls as $row) {
$arrs['id'] = $row['id'];
$arrs['resourceId'] = $row['room_id'];
$arrs['start'] = $row['start_time'];
$arrs['end'] = $row['end_time'];
if ($param1 == "1") {
if ($row['position_id']) {
$ponos = \Position::model()->find('teacher_id=:id and id=:id2', [":id" => $param2, ":id2" => $row['position_id']]);
$arrs['title'] = '(' . $ponos->code . ')';
$arrs['desc'] = $ponos->listner->name;
$arrs['subj'] = '(' . $ponos->subject->name . ')';
$arrs['height'] = '100px';
$arrs['backgroundColor'] = $ponos->subject->color;
} else {
if ($row['group_id']) {
$ponos = \Group::model()->find('teacher_id=:id and id = :id2', [":id" => $param2, ':id2' => $row['group_id']]);
$arrs['title'] = '(' . $ponos->name . ')';
$arrs['desc'] = '';
$arrs['subj'] = '(' . $ponos->subject->name . ')';
$arrs['height'] = '100px';
$arrs['backgroundColor'] = $ponos->subject->color;
}
}
} else {
if ($param1 == "2") {
if ($row['position_id']) {
$ponos = \Position::model()->find('listner_id=:id and id=:id2', [":id" => $param2, ":id2" => $row['position_id']]);
$arrs['title'] = '(' . $ponos->code . ')';
$arrs['desc'] = $ponos->teacher->user->last_name;
$arrs['subj'] = '(' . $ponos->subject->name . ')';
$arrs['height'] = '100px';
$arrs['backgroundColor'] = $ponos->subject->color;
} else {
if ($row['group_id']) {
$ponos = \Group::model()->find('id =:id2', [':id2' => $row['group_id']]);
$arrs['title'] = '(гр ' . $ponos->name . ')';
$arrs['desc'] = $ponos->teacher->user->last_name . ' ' . $ponos->teacher->user->first_name;
$arrs['subj'] = '(' . $ponos->subject->name . ')';
$arrs['height'] = '100px';
$arrs['backgroundColor'] = $ponos->subject->color;
}
}
} else {
if ($param1 == 0 && $param2 == 0) {
if ($row['position_id']) {
$ponos = \Position::model()->findByPk($row['position_id']);
$arrs['title'] = '(' . $ponos->code . ')';
$arrs['desc'] = $ponos->listner->name;
$arrs['subj'] = '(' . $ponos->subject->name . ')';
$arrs['height'] = '100px';
$arrs['backgroundColor'] = $ponos->subject->color;
} else {
if ($row['group_id']) {
$ponos = \Group::model()->findByPk($row['group_id']);
$arrs['title'] = '(' . $ponos->name . ')';
$arrs['desc'] = $ponos->teacher->user->last_name . ' ' . $ponos->teacher->user->first_name;
$arrs['subj'] = '(' . $ponos->subject->name . ')';
$arrs['height'] = '100px';
//.........這裏部分代碼省略.........
示例6: getFaceImg
public static function getFaceImg($id)
{
if (!$id) {
return false;
}
$_sql = "SELECT id FROM {{attachments}} WHERE logid={$id} AND classify='poi' AND status=1 ORDER BY favor DESC LIMIT 1";
$info = Yii::app()->db->createCommand($_sql)->queryRow();
if (!empty($info)) {
Position::model()->updateByPk($id, array('faceimg' => $info['id']));
}
return $info['id'];
}
示例7: autoProcessor
public function autoProcessor($item, $readOnly)
{
$field = $item["data-field"];
$value = $this->getValue($item);
$isTextAuto = substr($field, 0, 8) !== "sys_list";
if ($isTextAuto) {
return $this->textProcessor($item, $readOnly);
} elseif (!empty($value)) {
switch ($field) {
case "sys_list_dept":
$value = Department::model()->fetchDeptNameByDeptId($value, ",", true);
break;
case "sys_list_pos":
$value = Position::model()->fetchPosNameByPosId($value);
break;
default:
$value = User::model()->fetchRealnameByUid($value);
break;
}
}
return $value;
}
示例8: position
public static function position()
{
return CHtml::listData(Position::model()->desc()->findAll(), 'position_id', 'name');
}
示例9: actionUpload
public function actionUpload()
{
$uptype = zmf::filterInput($_GET['type'], 't', 1);
$logid = zmf::filterInput($_GET['id']);
//所屬對象
$reImgsize = zmf::filterInput($_GET['imgsize']);
//返回圖片的尺寸
$fileholder = zmf::filterInput($_GET['fileholder'], 't', 1);
//上傳控件的ID
//將ads替換為flash
if (!isset($uptype) or !in_array($uptype, array('columns', 'coverimg', 'flash', 'link', 'album', 'posts', 'poi', 'poipost', 'answer', 'question', 'siteinfo', 'goods', 'group', 'avatar'))) {
$this->jsonOutPut(0, '請設置上傳所屬類型' . $uptype);
}
if (Yii::app()->request->getParam('PHPSESSID')) {
Yii::app()->session->close();
$res = Yii::app()->session->setSessionID(Yii::app()->request->getParam('PHPSESSID'));
Yii::app()->session->open();
}
if (Yii::app()->user->isGuest) {
$this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
}
$checkInfo = UserPower::check('addImage', true);
if (!$checkInfo['status']) {
$this->jsonOutPut(0, $checkInfo['msg']);
}
if ($uptype == 'poi') {
if (!$logid || !is_numeric($logid)) {
$this->jsonOutPut(0, '無效上傳,請重試');
} else {
$poiInfo = Position::model()->findByPk($logid);
if (!$poiInfo || $poiInfo['status'] != Posts::STATUS_PASSED) {
$this->jsonOutPut(0, '無效上傳,請重試');
}
}
}
if (!$fileholder) {
$fileholder = 'filedata';
}
if (!isset($_FILES[$fileholder]) || !is_uploaded_file($_FILES[$fileholder]["tmp_name"]) || $_FILES[$fileholder]["error"] != 0) {
$this->jsonOutPut(0, '無效上傳,請重試');
}
$model = new Attachments();
$img = CUploadedFile::getInstanceByName($fileholder);
$ext = $img->getExtensionName();
$size = $img->getSize();
if ($size > zmf::config('imgMaxSize')) {
$this->jsonOutPut(0, '上傳文件最大尺寸為:' . tools::formatBytes(zmf::config('imgMaxSize')));
}
$upExt = zmf::config("imgAllowTypes");
if (!preg_match('/^(' . str_replace('*.', '|', str_replace(';', '', $upExt)) . ')$/i', $ext)) {
$this->jsonOutPut(0, '上傳文件擴展名必需為:' . $upExt);
}
$sizeinfo = getimagesize($_FILES[$fileholder]["tmp_name"]);
if ($sizeinfo['0'] < zmf::config('imgMinWidth') or $sizeinfo[1] < zmf::config('imgMinHeight')) {
$this->jsonOutPut(0, "要求上傳的圖片尺寸,寬不能不小於" . zmf::config('imgMinWidth') . "px,高不能小於" . zmf::config('imgMinHeight') . "px.");
}
$ctime = zmf::now();
$uid = zmf::uid();
$dirs = zmf::uploadDirs($ctime, 'app', $uptype, null, true);
$fileName = uniqid() . '.' . $ext;
$origin = $dirs['origin'];
unset($dirs['origin']);
$uploadedFiles = array();
$uploadedFiles[] = array('from' => $origin . $fileName, 'to' => zmf::ftpPath($ctime, $uptype, 'origin') . $fileName);
if (move_uploaded_file($_FILES[$fileholder]["tmp_name"], $origin . $fileName)) {
$data = array();
if ($uptype == 'posts') {
$status = Posts::STATUS_DELED;
} else {
$status = Posts::STATUS_PASSED;
}
$data['uid'] = $uid;
$data['logid'] = $logid;
$data['filePath'] = $fileName;
$data['fileDesc'] = $fileName;
$data['classify'] = $uptype;
$data['covered'] = '0';
$data['cTime'] = time();
$data['status'] = $status;
$data['width'] = $sizeinfo[0];
$data['height'] = $sizeinfo[1];
$data['size'] = $size;
if ($uptype == 'poi') {
$data['areaid'] = $poiInfo['areaid'];
}
$model->attributes = $data;
if ($model->validate()) {
if ($model->save()) {
if ($uptype == 'poi') {
Posts::updateCount($logid, 'Position', 1, 'attach');
} elseif ($uptype == 'avatar') {
Users::model()->updateByPk($uid, array('avatar' => $model->id));
}
// $image = Yii::app()->image->load($origin . $fileName);
// $_quality = zmf::config('imgQuality');
// $quality = isset($quality) ? $quality : 100;
Yii::import('application.vendors.thinkphp.*');
require_once 'ImageGd.php';
if (in_array($uptype, array('group', 'avatar'))) {
$rate = 1;
//.........這裏部分代碼省略.........
示例10: actionDynamicpositions
public function actionDynamicpositions()
{
$data = Position::model()->findAll('department_id=:department_id', array(':department_id' => (int) $_POST['Worker']['department_id']));
$data = CHtml::listData($data, 'id', 'name');
foreach ($data as $value => $name) {
echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
}
}
示例11: array
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#position_dialog").dialog("open"); return false;'));
?>
<?php
echo $form->error($model, 'positionid');
?>
</td>
<td>
<?php
echo $form->labelEx($model, 'levelorgid');
?>
<?php
echo $form->hiddenField($model, 'levelorgid');
?>
<input type="text" name="levelorgname" id="levelorgname" readonly style="width:75%" value="<?php
echo Position::model()->findByPk($model->levelorgid) !== null ? Position::model()->findByPk($model->levelorgid)->levelorgname : '';
?>
">
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'levelorg_dialog', 'options' => array('title' => Yii::t('app', 'Level Organization'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$levelorg = new Levelorg('searchwstatus');
$levelorg->unsetAttributes();
// clear any default values
if (isset($_GET['Levelorg'])) {
$levelorg->attributes = $_GET['Levelorg'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'levelorg-grid', 'dataProvider' => $levelorg->searchwstatus(), 'filter' => $levelorg, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("V",
array("name" => "send_absstatus",
"id" => "send_absstatus",
"onClick" => "$(\\"#levelorg_dialog\\").dialog(\\"close\\"); $(\\"#levelorgname\\").val(\\"$data->levelorgname\\");
$(\\"#Employee_levelorgid\\").val(\\"$data->levelorgid\\");"))'), array('name' => 'levelorgid', 'visible' => false, 'value' => '$data->levelorgid', 'htmlOptions' => array('width' => '1%')), 'levelorgname')));
示例12: actionDel
public function actionDel()
{
if (Ibos::app()->request->getIsAjaxRequest()) {
$id = EnvUtil::getRequest("id");
$ids = explode(",", trim($id, ","));
foreach ($ids as $positionId) {
Position::model()->deleteByPk($positionId);
Ibos::app()->authManager->removeAuthItem($positionId);
PositionResponsibility::model()->deleteAll("`positionid` = :positionid", array(":positionid" => $positionId));
PositionRelated::model()->deleteAll("positionid = :positionid", array(":positionid" => $positionId));
NodeRelated::model()->deleteAll("positionid = :positionid", array(":positionid" => $positionId));
$relatedIds = User::model()->fetchUidByPosId($positionId);
if (!empty($relatedIds)) {
User::model()->updateByUids($relatedIds, array("positionid" => 0));
}
PositionUtil::cleanPurvCache($positionId);
}
OrgUtil::update();
$this->ajaxReturn(array("IsSuccess" => true), "json");
}
}
示例13: actionAllowedlist
public function actionAllowedlist()
{
$feedId = intval(EnvUtil::getRequest("feedid"));
$feed = Feed::model()->getFeedInfo($feedId);
if (!$feed) {
exit("該條動態不存在");
}
$list = array();
if ($feed["view"] == "1") {
$list["users"] = Ibos::lang("My self");
} elseif (!empty($feed["userid"])) {
$list["users"] = User::model()->fetchRealnamesByUids($feed["userid"]);
}
if (!empty($feed["deptid"])) {
if ($feed["deptid"] == "alldept" || $feed["view"] == "0") {
$list["dept"] = Ibos::lang("All dept");
} else {
if ($feed["view"] == "2") {
$deptIds = StringUtil::filterStr(Ibos::app()->user->alldeptid . "," . Ibos::app()->user->alldowndeptid);
} else {
$deptIds = $feed["deptid"];
}
if (!empty($deptIds)) {
$list["dept"] = Department::model()->fetchDeptNameByDeptId($deptIds);
} else {
$list["dept"] = "";
}
}
}
if (!empty($feed["positionid"])) {
$list["pos"] = Position::model()->fetchPosNameByPosId($feed["positionid"]);
}
$this->renderPartial("allowedlist", $list);
}
示例14: loadModel
/**
* Возвращает модель по указанному идентификатору
* Если модель не будет найдена - возникнет HTTP-исключение.
*
* @param integer идентификатор нужной модели
*
* @return void
*/
public function loadModel($id)
{
$model = Position::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, Yii::t('ListnerModule.listner', 'Запрошенная страница не найдена.'));
}
return $model;
}
示例15: actionSubjectGroup
public function actionSubjectGroup($id)
{
$roles = ['1', '5', '3', '2'];
$role = \Yii::app()->user->role;
if (array_intersect($role, $roles)) {
$model = Position::model()->findByPk($id);
if ($model->group_id) {
$this->render('subjectListGroup', ['model' => $model]);
} else {
$this->redirect('/listner/subject/lessons/' . $id);
}
} else {
throw new CHttpException(403, 'Ошибка прав доступа.');
}
}