| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?php
- /**
- * 移动端应用控制器页面
- * 主页:http://www.rockoa.com/
- * 软件:信呼
- * 作者:雨中磐石(rainrock)
- * 日期:2016-10-10
- */
- class yingClassAction extends ActionNot{
-
- public $openfrom = '';
-
- public function initAction()
- {
- $this->mweblogin(0, true);
- $openfrom = $this->get('openfrom');
- if(isempt($openfrom))$openfrom = $this->get('cfrom');
- if(!isempt($openfrom)){
- $this->rock->setsession('openfrom', $openfrom);
- }else{
- $openfrom = $this->rock->session('openfrom');
- }
- $this->openfrom = $openfrom;
- $this->assign('openfrom', $this->openfrom);
- }
-
- private function bd6($str)
- {
- return $this->jm->base64decode($str);
- }
- // 自定义页面
- public function testAction()
- {
- return $this->get('num');
- }
- public function defaultAction()
- {
- // 检查用户权限
- $ybarr = $this->option->authercheck();
- // 如果返回的是字符串,说明存在权限问题,直接返回错误信息
- if(is_string($ybarr))return $ybarr;
- // 获取授权密钥和其他相关信息
- $authkey = $ybarr['authkey'];
- $num = $this->get('num');
- $mnum = $this->get('mnum'); //模块编号
- // 将授权密钥传递给视图
- $this->assign('xhauthkey', getconfig('authkey', $authkey));
- // 如果指定了模块编号,则显示对应模块并返回
- if(!isempt($mnum)){
- $this->showmodenum($mnum);
- return;
- }
- // 获取应用信息
- $reim = m('reim');
- $arr = $reim->getagent(0, "and `num`='$num'");
- // 如果应用不存在,输出错误信息并退出
- if(!$arr)exit('应用['.$num.']不存在');
- $rs = $arr[0];
- // 设置页面标题
- $this->title = $rs['name'];
- // 构建应用页面和脚本的 URL
- $yyurl = ''.P.'/we/ying/yingyong/'.$num.'.html';
- if(!file_exists($yyurl))$yyurl='';
- $yyurljs = ''.P.'/we/ying/yingyong/'.$num.'.js';
- if(!file_exists($yyurljs))$yyurljs='';
- // 检查是否为常用应用
- $rs['iscy'] = $this->iscy($num);
- $this->assign('arr', $rs);
- $this->assign('num', $num);
-
-
- $this->assign('yyurl', $yyurl);
- $this->assign('yyurljs', $yyurljs);
- $this->assign('searchmsg', '输入关键词搜索');
- $this->assign('typename', '');
- // 设置当前用户在应用上的权限
- $gid = $rs['id'];
- $reim->setallyd('agent', $this->adminid, $gid);
- // 包含应用类文件并初始化
- $clasne = 'ying_'.$num.'Class';
- $classpath = ''.P.'/we/ying/yingyong/'.$clasne.'.php';
- if(file_exists($classpath)){
- include_once($classpath);
- $yingobj = new $clasne();
- $yingobj->initYing($this);
- }
- // 记录打开应用的日志
- if(getconfig('useropt')=='1')m('log')->addlog('打开应用', '应用['.$num.'.'.$this->title.']');
- }
-
- //默认根据模块显示
- private function showmodenum($mnum)
- {
- $typename = '';
- // 初始化流程对象
- $flow = m('flow')->initflow($mnum);
- // 获取模块信息
- $mrs = $flow->moders;
- // 检查模块状态,如果已停用则退出
- if($mrs['status']=='0')exit('模块['.$mnum.','.$mrs['name'].']已停用');
- // 获取流程的搜索数据
- $souarr = $flow->flowwesearchdata(0);
- $searchmsg = arrvalue($souarr, 'searchmsg','输入关键词搜索');
- $typename = arrvalue($souarr, 'typename');
- // 设置页面标题
- $this->title = $mrs['name'];
- // 获取参数值
- $pnum = $this->get('pnum');
- // 初始化菜单数组
- $menu = array();
- // 获取模块条件
- $atypearr = m('where')->getmywhere($mrs['id'], $this->adminid, $pnum);
- // 如果条件不存在,退出并提示用户创建条件
- if(!$atypearr)exit('请到【流程模块→流程模块条件】建条件,分组编号要为空');
- // 根据模块属性判断是否添加抄送和经我处理的菜单项
- if(isempt($pnum)){
- if($mrs['iscs']>0)$atypearr[] = array('id' => 0,'num' => 'chaos','name' => '抄送给我');
- if($mrs['isflow']>0)$atypearr[] = array('id' => 0,'num' => 'mychuli','name' => '经我处理');
- }
- // 判断是否允许新增记录,并添加相应的菜单项
- $isadd = m('view')->isadd($mrs['id'], $this->adminid);
- if($isadd)$atypearr[] = array('id' => 0,'num' => 'add','type' => 1,'name' => '+新增');
- // 构建主菜单
- foreach($atypearr as $k1=>$rs1){
- $uar = array('type' => 0,'name' => $rs1['name'],'url' => $rs1['num'].'|'.$mnum.'','num' => '','submenu'=> array());
- if(arrvalue($rs1,'type')==1){$uar['type']=1;$uar['url']='add_'.$mnum.'';}
- $menu[] = $uar;
- if($k1>1)break;
- }
- // 如果菜单项数量大于3,则添加"更多"子菜单
- if(count($atypearr)>3){
- $submenu = array();
- foreach($atypearr as $k1=>$rs1){
- $uar = array('type' => 0,'name' => $rs1['name'],'url' => $rs1['num'].'|'.$mnum.'','num' => '','submenu'=> array());
- if(arrvalue($rs1,'type')==1){$uar['type']=1;$uar['url']='add_'.$mnum.'';}
- if($k1>1)$submenu[] = $uar;
- }
- $menu[2] = array(
- 'name' => '更多>>',
- 'num' => '',
- 'submenu' => $submenu,
- );
- }
- // 如果菜单为空,则添加默认菜单项
- if(!$menu)$menu[] = array(
- 'name' => $mrs['name'],
- 'url' => 'my|'.$mnum.'',
- 'num' => '',
- 'submenu' => array(),
- );
- // 构建返回数组
- $arr = array(
- 'face' => '',
- 'leixing'=>$mnum,
- 'menu' => $menu,
- 'num' => 'base',
- 'name' => $mrs['name'],
- );
- // 初始化其他变量
- $yyurl = '';
- $yyurljs = '';
- // 分配变量到视图
- $this->assign('searchmsg', $searchmsg);
- $this->assign('yyurl', $yyurl);
- $this->assign('arr', $arr);
- $this->assign('yyurljs', $yyurljs);
- $this->assign('typename', $typename);
- // 如果用户操作日志开启,记录打开模块应用的日志
- if(getconfig('useropt')=='1')m('log')->addlog('打开模块应用', '模块['.$mnum.'.'.$this->title.']');
- }
-
-
-
- private function iscy($num)
- {
- // 获取当前用户的应用展示 ID
- $myyyid= $this->option->getval('yinghomeshow_'.$this->adminid.'');
- // 默认设置为非常用应用
- $iscy = 0;
- // 如果当前用户的应用展示 ID 不为空,并且包含指定的应用编号,则将其标记为常用应用
- if(!isempt($myyyid) && contain(','.$myyyid.',',','.$num.','))$iscy=1;
- return $iscy;
- }
-
- public function locationAction()
- {
- $this->title = '考勤定位';
- $kq = m('kaoqin');
- $arr = m('waichu')->getoutrows($this->date,$this->adminid);
- $this->assign('rows', $arr);
- $dt = $this->rock->date;
- $dwarr = m('location')->getrows("uid='$this->adminid' and `optdt` like '$dt%'",'*','`id` desc');
- $this->assign('dwarr', $dwarr);
- $kqrs = $kq->dwdkrs($this->adminid, $this->date);
- $isgzh = m('wxgzh:index')->isusegzh();
- $this->assign('isgzh', $isgzh);
- $this->assign('kqrs', $kqrs);
- $dwids = arrvalue($kqrs, 'dwids');
- $kqors = array();
- if(!isempt($dwids)){
- $kqors = m('kqdw')->getrows("id in($dwids) and `id`<>".$kqrs['id']."");
- }
- $this->assign('kqors', $kqors);
- $this->smartydata['qqmapkey'] = getconfig('qqmapkey','55QBZ-JGYLO-BALWX-SZE4H-5SV5K-JCFV7');
- }
-
- /**
- * 最新打卡使用
- */
- public function dakaAction()
- {
- $this->title = '考勤打卡';
-
- $kq = m('kaoqin');
- $dt = $this->rock->date;
- $dwarr = m('location')->getrows("uid='$this->adminid' and `optdt` like '$dt%'",'*','`id` desc');
- $this->assign('dwarr', $dwarr);
- $kqrs = $kq->dwdkrs($this->adminid, $this->date);
- $isgzh = m('wxgzh:index')->isusegzh();
- $this->assign('isgzh', $isgzh);
- $this->assign('iscy', $this->iscy('kqdaka'));
- $this->assign('kqrs', $kqrs);
- $dwids = arrvalue($kqrs, 'dwids');
- $kqors = array();
- if(!isempt($dwids)){
- $kqors = m('kqdw')->getrows("id in($dwids) and `id`<>".$kqrs['id']."");
- }
- $this->assign('kqors', $kqors);
- $this->smartydata['qqmapkey'] = getconfig('qqmapkey','55QBZ-JGYLO-BALWX-SZE4H-5SV5K-JCFV7');
- }
- }
|