Beispiel #1
0
 public function updateNavOpen($sign, $isshow = 0)
 {
     if (!$sign) {
         return false;
     }
     $nav = $this->_getNavDs()->getNavBySign('my', $sign);
     if (!$nav['navid']) {
         return false;
     }
     Wekit::load('SRV:nav.dm.PwNavDm');
     $dm = new PwNavDm($nav['navid']);
     $dm->setIsshow($isshow);
     $resource = $this->_getNavDs()->updateNav($dm);
     if ($resource instanceof PwError) {
         return false;
     }
     $this->updateConfig();
     return true;
 }
Beispiel #2
0
 /**
  * 修改一条导航信息
  *
  * @param object $dm导航数据模型
  * @return array
  */
 public function updateNav(PwNavDm $dm)
 {
     $resource = $dm->beforeUpdate();
     if ($resource instanceof PwError) {
         return $resource;
     }
     $data = $dm->getData();
     $data['rootid'] = $data['parentid'] ? $data['parentid'] : $dm->navid;
     return $this->_getNavDao()->updateNav($dm->navid, $data);
 }
Beispiel #3
0
 /**
  * Enter description here .
  *
  *
  * ..
  *
  * @param unknown_type $type        	
  * @param PwInstallApplication $install        	
  * @return PwError boolean
  */
 protected function _install($type, $install)
 {
     $manifest = $install->getManifest();
     if (!$this->link) {
         $this->link = 'index.php?m=app&app=' . $manifest->getApplication('alias');
     }
     $dm = new PwNavDm();
     $dm->setLink($this->link)->setType($type);
     if ($type == 'my') {
         $prefix = Wind::getComponent('i18n')->getMessage('ADMIN:nav.my.prefix');
         $dm->setName($prefix . $manifest->getApplication('name'))->setSign($manifest->getApplication('alias'));
     } else {
         $dm->setName($manifest->getApplication('name'));
     }
     $id = $this->_navDs()->addNav($dm);
     if ($id instanceof PwError) {
         return $id;
     }
     $install->addInstallLog('nav', $id);
     $this->update();
     file_put_contents(DATA_PATH . 'tmp/log', 'nav!', FILE_APPEND);
     return true;
 }
Beispiel #4
0
 /**
  * 导航修改处理器
  *
  * @return void
  */
 public function doeditAction()
 {
     $keys = array('navid', 'type', 'parentid', 'name', 'link', 'fontColor', 'fontBold', 'fontItalic', 'fontUnderline', 'alt', 'target', 'orderid', 'isshow');
     list($navid, $type, $parentid, $name, $link, $fontColor, $fontBold, $fontItalic, $fontUnderline, $alt, $target, $orderid, $isshow) = $this->getInput($keys, 'post');
     $router = Wind::getComponent('router')->getRoute('pw')->matchUrl($link);
     if (!$name || !$type) {
         $this->showError("ADMIN:nav.add.fail.strlen.name");
     }
     Wekit::load('SRV:nav.dm.PwNavDm');
     $dm = new PwNavDm($navid);
     $dm->setType($type)->setParentid($parentid)->setName($name)->setLink($link)->setStyle($fontColor, $fontBold, $fontItalic, $fontUnderline)->setAlt($alt)->setTarget($target)->setOrderid($orderid)->setIsshow($isshow);
     if ($type != 'my') {
         $dm->setSign($router);
     }
     $resource = $this->_getNavDs()->updateNav($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     $this->_getNavService()->updateConfig();
     $this->showMessage('ADMIN:success');
 }