Ejemplo n.º 1
0
 public function actionEdit()
 {
     if (EnvUtil::getRequest("formhash")) {
         $id = intval(EnvUtil::getRequest("id"));
         $name = StringUtil::filterStr(EnvUtil::getRequest("name"));
         $url = StringUtil::filterStr(EnvUtil::getRequest("url"));
         $icon = StringUtil::filterStr(EnvUtil::getRequest("quicknavimg"));
         if (!empty($icon)) {
             FileUtil::copyToDir($icon, $this->_iconPath);
             $info = pathinfo($icon);
             $saveName = $info["basename"];
         } else {
             $saveName = StringUtil::random(16) . ".png";
             $val = EnvUtil::getRequest("fontvalue");
             $this->createColorImg($saveName, $val);
         }
         $data = array("name" => $name, "url" => $url, "description" => "", "icon" => $saveName);
         MenuCommon::model()->modify($id, $data);
         $this->success(Ibos::lang("Update succeed", "message"), $this->createUrl("quicknav/index"));
     } else {
         $op = EnvUtil::getRequest("op");
         if (empty($op)) {
             $id = intval(EnvUtil::getRequest("id"));
             $menu = MenuCommon::model()->fetchByPk($id);
             if (empty($menu)) {
                 $this->error(Ibos::lang("Quicknav not fount tip"), $this->createUrl("quicknav/index"));
             }
             $menu["icon"] = FileUtil::fileName($this->_iconPath . $menu["icon"]);
             $this->render("edit", array("menu" => $menu));
         } else {
             $this->{$op}();
         }
     }
 }
Ejemplo n.º 2
0
 public static function moveTempFile($file, $path)
 {
     if (FileUtil::fileExists($file)) {
         $copySucceed = FileUtil::copyToDir($file, $path);
         if (!$copySucceed) {
             throw new EnvException(Ibos::lang("Move file failed", "error", array("file" => $file, "path" => $path)));
         }
         return basename($file);
     }
 }