示例#1
0
文件: plugin.php 项目: vazahat/dudex
 /**
  * Returns class instance
  *
  * @return UHEADER_CLASS_Plugin
  */
 public static function getInstance()
 {
     if (!isset(self::$classInstance)) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
示例#2
0
 public function index($params)
 {
     $document = OW::getDocument();
     $menu = UHEADER_CTRL_Admin::getMenu();
     $menu->getElement("gallery")->setActive(true);
     $this->addComponent("menu", $menu);
     $tplId = empty($params["tplId"]) ? null : $params["tplId"];
     $roleId = empty($_GET["role"]) ? null : $_GET["role"];
     UHEADER_CLASS_Plugin::getInstance()->includeStatic();
     UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("admin.css");
     $uniqId = uniqid("uheader-cg-");
     if (empty($roleId) && !empty($tplId)) {
         $roles = $this->service->findRoleIdsByTemplateId($tplId);
         if (!empty($roles)) {
             $roleId = reset($roles);
         }
     }
     $roleIds = $roleId === null ? null : array($roleId);
     $list = $this->service->findTemplateList($roleIds);
     $tplList = array();
     foreach ($list as $template) {
         /*@var $template UHEADER_BOL_Template */
         $tplList[$template->id] = $this->getTplInfo($template);
     }
     $currentItem = $tplId === null || empty($tplList[$tplId]) ? reset($tplList) : $tplList[$tplId];
     $this->assign("list", $tplList);
     $this->assign("current", $currentItem);
     $this->assign("uploader", OW::getRouter()->urlFor(__CLASS__, "templateUploader"));
     $this->assign("uniqId", $uniqId);
     $config = array();
     $config['avatarSize'] = $this->config['avatar_big_size'];
     $config['coverHeight'] = $this->config["cover_height"];
     $config['previewHeight'] = self::ITEM_WIDTH / self::CANVAS_WIDTH * $config['coverHeight'];
     $this->assign("config", $config);
     $this->addComponent("contextToolbar", $this->getContextToolbar());
     $settings = array("rsp" => OW::getRouter()->urlFor(__CLASS__, "rsp"), "current" => $currentItem);
     $js = UTIL_JsGenerator::newInstance();
     $js->newObject(array("UHEADER", "activeGallery"), "UHEADER.AdminGallery", array($uniqId, $settings));
     $document->addOnloadScript($js);
     $roles = BOL_AuthorizationService::getInstance()->findNonGuestRoleList();
     $tplRoles = array();
     foreach ($roles as $role) {
         /* @var $role BOL_AuthorizationRole */
         $roleLabel = BOL_AuthorizationService::getInstance()->getRoleLabel($role->name);
         $tplRoles[] = array("id" => $role->id, "selected" => $roleId == $role->id, "label" => $roleLabel, "url" => OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute("uheader-settings-gallery"), array("role" => $role->id)));
     }
     $this->assign("currentRoleId", $roleId);
     $this->assign("roleList", $tplRoles);
     $this->assign("allListUrl", OW::getRouter()->urlForRoute("uheader-settings-gallery"));
     $this->assign("previewWidth", self::ITEM_WIDTH);
     $this->initInfoLines();
     $this->assign("pluginUrl", UHEADER_CTRL_Admin::PLUGIN_STORE_URL);
 }
示例#3
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $coverId = $this->vars["coverId"];
     $cover = UHEADER_BOL_Service::getInstance()->findCoverById($coverId);
     if ($cover === null) {
         $this->setVisible(false);
         return;
     }
     UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("uheader.css");
     $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover);
     $this->assign('src', $src);
     $this->assign('imageCss', $cover->getCssString());
     $this->assign("scale", $cover->getRatio());
     $this->assign("url", BOL_UserService::getInstance()->getUserUrl($cover->userId));
 }
示例#4
0
文件: admin.php 项目: vazahat/dudex
 public function index()
 {
     UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("admin.css");
     $form = new UHEADER_SettingForm($this->activePlugins);
     $this->addForm($form);
     if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
         $form->process($_POST, $this->activePlugins);
         OW::getFeedback()->info(OW::getLanguage()->text('uheader', 'settings_saved_message'));
         $this->redirect();
     }
     OW::getDocument()->setHeading(OW::getLanguage()->text('uheader', 'heading_configuration'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
     $this->assign('photoShare', OW::getConfig()->getValue('uheader', 'photo_share'));
     $this->assign('photoViewMode', OW::getConfig()->getValue('uheader', 'tpl_view_mode'));
     $this->assign('plugins', $this->activePlugins);
     $this->assign('minHeight', UHEADER_SettingForm::COVER_MIN_HEIGHT);
     $this->assign('maxHeight', UHEADER_SettingForm::COVER_MAX_HEIGHT);
     $this->addComponent("menu", self::getMenu());
     $this->assign("pluginUrl", self::PLUGIN_STORE_URL);
 }
示例#5
0
文件: header.php 项目: vazahat/dudex
 public function __construct($userId)
 {
     parent::__construct();
     UHEADER_CLASS_Plugin::getInstance()->includeStatic();
     $this->userId = $userId;
     $this->service = UHEADER_BOL_Service::getInstance();
     $this->cover = $this->service->findCoverByUserId($this->userId, UHEADER_BOL_Cover::STATUS_ACTIVE);
     if ($this->cover === null) {
         $removedCover = $this->service->findCoverByUserId($this->userId, UHEADER_BOL_Cover::STATUS_REMOVED);
         if ($removedCover === null) {
             $template = $this->service->findDefaultTemplateForUser($userId);
             if ($template !== null) {
                 $this->cover = $template->createCover($this->userId);
                 $this->templateId = $template->id;
                 $this->defaultTemplateMode = true;
             }
         }
     } else {
         $this->hasCover = true;
     }
     $this->defaultTemplatesCount = $this->service->findTemplatesCountForUser($this->userId, true);
 }
示例#6
0
 public function __construct($userId)
 {
     parent::__construct();
     $cover = UHEADER_BOL_Service::getInstance()->findCoverByUserId($userId);
     if (empty($cover)) {
         $this->setVisible(false);
         return;
     }
     UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("uheader.css");
     $uniqId = uniqid('uheader-');
     $this->assign('uniqId', $uniqId);
     $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#' . $uniqId, 'click', 'OW.ajaxFloatBox("UHEADER_CMP_CoverView", [e.data.userId], {
             layout: "empty",
             top: 50
         });
         return false;', array('e'), array('userId' => $userId));
     OW::getDocument()->addOnloadScript($js);
     $src = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover);
     $this->assign('src', $src);
     $cavas = $cover->getCanvas(self::ITEM_WIDTH);
     $this->assign('imageCss', $cover->getCssString());
     $this->assign('height', $cavas["height"]);
 }
示例#7
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $service = UHEADER_BOL_Service::getInstance();
     $cover = $service->findCoverByUserId($this->user->id, UHEADER_BOL_Cover::STATUS_ACTIVE);
     if ($cover === null) {
         $removedCover = $service->findCoverByUserId($this->user->id, UHEADER_BOL_Cover::STATUS_REMOVED);
         if ($removedCover === null) {
             $template = $service->findDefaultTemplateForUser($this->user->id);
             if ($template !== null) {
                 $cover = $template->createCover($this->user->id);
             }
         }
     }
     if ($cover === null) {
         return;
     }
     UHEADER_CLASS_Plugin::getInstance()->includeStaticFile("uheader.css");
     $tplCover = array();
     $tplCover["src"] = UHEADER_BOL_Service::getInstance()->getCoverUrl($cover);
     $tplCover['imageCss'] = $cover->getCssString();
     $tplCover["scale"] = $cover->getRatio();
     $this->assign("cover", $tplCover);
 }
示例#8
0
文件: header.php 项目: vazahat/dudex
 public function test()
 {
     UHEADER_CLASS_Plugin::getInstance()->includeStatic();
     /*$gallery = new UHEADER_CMP_CoverPreviewGallery(OW::getUser()->getId());
       $this->addComponent("gallery", $gallery);*/
     OW::getDocument()->addOnloadScript("OW.ajaxFloatBox('UHEADER_CMP_CoverPreviewGallery', [" . OW::getUser()->getId() . ", 781])");
 }