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
0
 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;
 }
 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
0
 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;
 }
 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';
                             $arrs['backgroundColor'] = $ponos->subject->color;
                         }
                     }
                 }
             }
         }
         //
         //            $arrs['title'] = '('.$row['code'].')';
         //            $arrs['desc'] = $row['lastname'];
         //            $arrs['subj'] = '('.$row['name'].')';
         //            $arrs['height'] = '100px';
         //            $arrs['backgroundColor']='#'.$row['color'];
         //            $arrs['group']=$row['pizda'];
         array_push($arr, $arrs);
     }
     echo \CJSON::encode($arr);
 }
示例#6
0
 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
0
 public function loadModel($id)
 {
     $model = Position::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, '该页面不存在或已删除');
     }
     return $model;
 }
示例#8
0
 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;
 }
示例#9
0
 public static function position()
 {
     return CHtml::listData(Position::model()->desc()->findAll(), 'position_id', 'name');
 }
示例#10
0
 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;
                 } else {
                     $rate = 0.75;
                 }
                 foreach ($dirs as $dk => $_dir) {
                     $image = new ImageGd($origin . $fileName);
                     if ($dk < 600) {
                         $image->thumb($dk, $dk * $rate, 'center');
                     } else {
                         $image->thumb($dk, 10000);
                         //$image->water(Yii::app()->basePath . '/../common/images/water.png',2);
                     }
                     $image->save($_dir . $fileName);
                     $_todir = zmf::ftpPath($ctime, $uptype, $dk);
                     $uploadedFiles[] = array('id' => $model->id, 'from' => $_dir . $fileName, 'to' => $_todir . $fileName);
                 }
                 $imgsize = $reImgsize > 0 ? $reImgsize : 170;
                 $returnimg = zmf::uploadDirs($ctime, 'site', $uptype, $imgsize) . $fileName;
                 $outPutData = array('status' => 1, 'attachid' => $model->id, 'imgsrc' => $returnimg);
                 $json = CJSON::encode($outPutData);
                 if (zmf::config('ftpon')) {
                     $asyncdata = "method=ftpupload&json=" . zmf::jiaMi(CJSON::encode($uploadedFiles));
                     AsyncController::Async($asyncdata);
                 }
                 if ($uptype == 'avatar') {
                     zmf::delFCache("userInfo-{$uid}");
                 }
                 echo $json;
             } else {
                 $this->jsonOutPut(0, '写入数据库错误');
             }
         } else {
             $this->jsonOutPut(0, '数据验证错误');
         }
     } else {
         $this->jsonOutPut(0, '移动到指定文件夹出错');
     }
 }
示例#11
0
 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);
     }
 }
示例#12
0
$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')));
示例#13
0
 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");
     }
 }
示例#14
0
 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);
 }
示例#15
0
echo CHtml::Button('...', array('onclick' => '$("#absstatus_dialog").dialog("open"); return false;'));
?>
    <?php 
echo $form->error($model, 'orgstructureid');
?>
	</div>

    <div class="row">
		<?php 
echo $form->labelEx($model, 'positionid');
?>
    <?php 
echo $form->hiddenField($model, 'positionid');
?>
    <input type="text" name="positionname" id="positionname" readonly value="<?php 
echo Position::model()->findByPk($model->positionid) !== null ? Position::model()->findByPk($model->positionid)->positionname : '';
?>
">
    <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'position_dialog', 'options' => array('title' => Yii::t('app', 'Organization Structure'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$this->widget('zii.widgets.grid.CGridView', array('id' => 'absstatus-grid', 'dataProvider' => $position->searchwstatus(), 'filter' => $position, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
          array("name" => "send_absstatus",
          "id" => "send_absstatus",
          "onClick" => "$(\\"#position_dialog\\").dialog(\\"close\\"); $(\\"#positionname\\").val(\\"$data->positionname\\"); $(\\"#Jobs_positionid\\").val(\\"$data->positionid\\");"))'), array('name' => 'positionid', 'visible' => false, 'value' => '$data->positionid', 'htmlOptions' => array('width' => '1%')), 'positionname', array('class' => 'CCheckBoxColumn', 'name' => 'recordstatus', 'selectableRows' => '0', 'header' => 'Record Status', 'checked' => '$data->recordstatus'), array('class' => 'CButtonColumn'))));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#position_dialog").dialog("open"); return false;'));
?>
    <?php 
echo $form->error($model, 'positionid');
?>
	</div>
 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет 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;
 }
 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, 'Ошибка прав доступа.');
     }
 }
示例#18
0
?>

	<?php 
echo $form->textFieldRow($model, 'emp_fname', array('class' => 'span3', 'size' => 50, 'maxlength' => 50));
?>

	<?php 
echo $form->textFieldRow($model, 'emp_mname', array('class' => 'span3', 'size' => 50, 'maxlength' => 50));
?>

	<?php 
echo $form->textFieldRow($model, 'emp_lname', array('class' => 'span3', 'size' => 50, 'maxlength' => 50));
?>

	<?php 
echo $form->dropDownListRow($model, 'position', CHtml::listData(Position::model()->findAll(), 'pos_id', 'pos_name'), array('class' => 'span3', 'prompt' => '---------- Choose Position ----------'));
?>

	<?php 
echo $form->dropDownListRow($model, 'dept_id', CHtml::listData(Department::model()->findAll(), 'dept_id', 'dept_name'), array('class' => 'span3', 'prompt' => '---------- Choose Department ----------'));
?>

	<?php 
echo $form->textFieldRow($model, 'contact_num', array('class' => 'span3', 'size' => 50, 'maxlength' => 50));
?>

	<?php 
echo $form->textFieldRow($model, 'email_add', array('class' => 'span3', 'size' => 50, 'maxlength' => 50));
?>

	<div class="form-actions">
示例#19
0
 public function handlePosition($event)
 {
     $records = Position::model()->fetchAllSortByPk("positionid");
     Syscache::model()->modify("position", $records);
 }
示例#20
0
文件: Posts.php 项目: ph7pal/wedding
 public static function getNearBy($arr, $origin)
 {
     $lat = $arr['lat'];
     $lng = $arr['long'];
     $notInclude = $arr['notId'];
     $limit = 5;
     if ($origin == '' || !in_array($origin, array('posts', 'position'))) {
         return false;
     }
     $_cal3 = "(ROUND(12756.274 * ASIN(SQRT(POW(SIN(((lat * PI() / 180.0) - ({$lat} * PI() / 180.0))/2),2) +COS(lat * PI() / 180.0)*COS({$lat} * PI() / 180.0)*POW(SIN(((`long` * PI() / 180.0)-({$lng} * PI() / 180.0))/2),2)))))";
     $longSql = "SELECT DISTINCT(id), '{$origin}',{$_cal3} AS distance FROM {{{$origin}}} WHERE status=1 AND id!={$notInclude} AND {$_cal3}<=10 ORDER BY distance LIMIT 0,{$limit}";
     $tops = Yii::app()->db->createCommand($longSql)->queryAll();
     if (!empty($tops)) {
         $ids = join(',', array_keys(CHtml::listData($tops, 'id', '')));
         $_into = zmf::now() . '#' . $ids;
         if ($origin != 'position') {
             Posts::model()->updateByPk($notInclude, array('nearby' => $_into));
             $_sql = "SELECT id,title FROM {{posts}} WHERE id IN({$ids}) AND status=" . Posts::STATUS_PASSED . " ORDER BY FIELD(id,{$ids})";
         } else {
             Position::model()->updateByPk($notInclude, array('nearby' => $_into));
             $_sql = "SELECT id,title_cn,title_en,title_local,score,scorer,classify FROM {{position}} WHERE id IN({$ids}) AND status=" . Posts::STATUS_PASSED . " ORDER BY FIELD(id,{$ids})";
         }
         if ($ids != '') {
             $tops = Yii::app()->db->createCommand($_sql)->queryAll();
         }
     }
     return $tops;
 }
示例#21
0
    ?>
    <div class="row">
        <div class="col-sm-7">
            <?php 
    echo $form->dropDownListGroup($model, 'subject_id', ['widgetOptions' => ['data' => CHtml::listData(Subject::model()->findAllBySql('SELECT * FROM spbp_subject_subject WHERE id <> ALL(SELECT t1.id FROM spbp_subject_subject t1
                                                            JOIN spbp_listner_position t2 ON t2.subject_id = t1.id
                                                                    WHERE t2.listner_id = ' . $_GET['id'] . '
                                                    )'), 'id', 'name'), 'htmlOptions' => ['empty' => '--выберите--', 'encode' => false]]]);
    ?>
        </div>
    </div>
<?php 
} elseif (isset($_GET['parent_group'])) {
    echo $form->hiddenField($model, 'subject_id', ['value' => Group::model()->findByPk($_GET['parent_group'])->subject_id, 'type' => 'hidden']);
} else {
    echo $form->hiddenField($model, 'subject_id', ['value' => Position::model()->findByPk($_GET['parent_id'])->subject_id, 'type' => 'hidden']);
}
?>

    <div class="row">
        <div class="col-sm-7">
            <?php 
echo $form->dropDownListGroup($model, 'type', ['widgetOptions' => ['data' => CHtml::listData(Type::model()->findAll(), 'id', 'name'), 'htmlOptions' => ['empty' => '--выберите--', 'encode' => false]]]);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-7">
            <div class="form-group">
                <label class="col-sm-5 control-label" for="price_chek">Акция по старой цене</label>
                <div class="col-sm-10">
 public function actionDoc($id)
 {
     $model = Position::model()->findByPk($id);
     $admin = User::model()->findBySql('SELECT * FROM spbp_user_user t1 JOIN spbp_user_role_to_user t2 ON t2.user_id = t1.id WHERE t2.role_id = 3 AND t1.branch_id =' . $model->listner->branch_id);
     $this->render('positionDoc', ['model' => $model, 'admin' => $admin]);
 }
示例#23
0
 public static function setPosition($positionId, $users)
 {
     $oldUids = User::model()->fetchUidByPosId($positionId, false);
     $userId = explode(",", trim($users, ","));
     $newUids = StringUtil::getUid($userId);
     $delDiff = array_diff($oldUids, $newUids);
     $addDiff = array_diff($newUids, $oldUids);
     if (!empty($addDiff) || !empty($delDiff)) {
         $updateUser = false;
         $userData = self::loadUser();
         if ($addDiff) {
             foreach ($addDiff as $newUid) {
                 $record = $userData[$newUid];
                 if (empty($record["positionid"])) {
                     User::model()->modify($newUid, array("positionid" => $positionId));
                     $updateUser = true;
                 } elseif (strcmp($record["positionid"], $positionId) !== 0) {
                     PositionRelated::model()->add(array("positionid" => $positionId, "uid" => $newUid), false, true);
                 }
             }
         }
         if ($delDiff) {
             foreach ($delDiff as $diffId) {
                 $record = $userData[$diffId];
                 PositionRelated::model()->delete("`positionid` = :positionid AND `uid` = :uid", array(":positionid" => $positionId, ":uid" => $diffId));
                 if (strcmp($positionId, $record["positionid"]) == 0) {
                     User::model()->modify($diffId, array("positionid" => 0));
                     $updateUser = true;
                 }
             }
         }
         $mainNumber = User::model()->count("`positionid` = :positionid", array(":positionid" => $positionId));
         $auxiliaryNumber = PositionRelated::model()->countByPositionId($positionId);
         Position::model()->modify($positionId, array("number" => (int) $mainNumber + $auxiliaryNumber));
         $updateUser && CacheUtil::update("users");
         OrgUtil::update();
     }
 }
示例#24
0
 *   @license  https://github.com/yupe/yupe/blob/master/LICENSE BSD
 *   @link     http://yupe.ru
 **/
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', ['action' => Yii::app()->createUrl($this->route), 'method' => 'get', 'type' => 'vertical', 'htmlOptions' => ['class' => 'well']]);
?>

<fieldset>
    <div class="row">
        <div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'id', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('id'), 'data-content' => $model->getAttributeDescription('id')]]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->dropDownListGroup($model, 'position_id', ['widgetOptions' => ['data' => CHtml::listData(Position::model()->findAll(), 'id', 'id')]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'number', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('number'), 'data-content' => $model->getAttributeDescription('number')]]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'start_time', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('start_time'), 'data-content' => $model->getAttributeDescription('start_time')]]]);
?>
        </div>
		<div class="col-sm-3">
            <?php 
echo $form->textFieldGroup($model, 'end_time', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('end_time'), 'data-content' => $model->getAttributeDescription('end_time')]]]);
示例#25
0
 /**
  * 重定向坐标
  */
 public function actionRedpoi()
 {
     Users::checkPower('redirectPoi');
     $fid = zmf::filterInput($_POST['fid']);
     $tid = zmf::filterInput($_POST['tid']);
     if (!$fid || !$tid || $fid == $tid) {
         $this->jsonOutPut(0, '数据错误');
     }
     $finfo = Position::getOne($fid);
     if (!$finfo || $finfo['status'] != Posts::STATUS_PASSED) {
         $this->jsonOutPut(0, '源坐标不存在或已删除');
     }
     $tinfo = Position::getOne($tid);
     if (!$tinfo || $tinfo['status'] != Posts::STATUS_PASSED) {
         $this->jsonOutPut(0, '目标坐标不存在或已删除');
     }
     if ($finfo['redirect'] > 0) {
         $this->jsonOutPut(0, '源坐标已设置过重定向,不能重复设置');
     }
     if ($tinfo['redirect'] == $fid) {
         $this->jsonOutPut(0, '目标坐标已设置重定向到本坐标');
     }
     if (Position::model()->updateByPk($fid, array('redirect' => $tid, 'status' => Posts::STATUS_REDIRECT))) {
         $this->jsonOutPut(1, '设置成功');
     } else {
         $this->jsonOutPut(0, '设置失败');
     }
 }