Пример #1
0
 public function render()
 {
     $content = array();
     if (!empty($this->content)) {
         $content['html'] = $this->content;
         $content['uniqId'] = $this->getContentUniqId();
     }
     $this->assign('item', array('uniqId' => $this->getUniqId(), 'class' => $this->getClass(), 'content' => $content, 'html' => $this->control, 'hidden' => $this->getIsHidden()));
     return parent::render();
 }
Пример #2
0
 public function onBeforeRender()
 {
     if ($this->getTemplate() === null) {
         $this->setTemplate(OW::getThemeManager()->getMasterPageTemplate(self::TEMPLATE_GENERAL));
     }
     echo "template->" . $this->getTemplate();
     parent::onBeforeRender();
 }
Пример #3
0
 function base_dev_tool(BASE_CLASS_EventCollector $event)
 {
     $viewRenderer = OW_ViewRenderer::getInstance();
     $prevVars = $viewRenderer->getAllAssignedVars();
     $viewRenderer->assignVar('oxwall', (array) simplexml_load_file(OW_DIR_ROOT . 'ow_version.xml'));
     $requestHandlerData = OW::getRequestHandler()->getDispatchAttributes();
     try {
         $ctrlPath = OW::getAutoloader()->getClassPath($requestHandlerData['controller']);
     } catch (Exception $e) {
         $ctrlPath = 'not_found';
     }
     $requestHandlerData['ctrlPath'] = $ctrlPath;
     $requestHandlerData['paramsExp'] = var_export(empty($requestHandlerData['params']) ? array() : $requestHandlerData['params'], true);
     $viewRenderer->assignVar('requestHandler', $requestHandlerData);
     $viewRenderer->assignVar('profiler', UTIL_Profiler::getInstance()->getResult());
     $viewRenderer->assignVar('memoryUsage', function_exists('memory_get_peak_usage') ? sprintf('%0.3f', memory_get_peak_usage(true) / 1048576) : 'No info');
     if (!OW_DEV_MODE || true) {
         //TODO remove hardcode
         $viewRenderer->assignVar('clrBtnUrl', OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('BASE_CTRL_Base', 'turnDevModeOn'), array('back-uri' => urlencode(OW::getRouter()->getUri()))));
     }
     $rndItems = OW_Renderable::getRenderedClasses();
     $rndArray = array('mp' => array(), 'cmp' => array(), 'ctrl' => array());
     foreach ($rndItems as $key => $item) {
         try {
             $src = OW::getAutoloader()->getClassPath($key);
         } catch (Exception $e) {
             $src = 'not_found';
         }
         $addItem = array('class' => $key, 'src' => $src, 'tpl' => $item);
         if (strstr($key, 'OW_MasterPage')) {
             $rndArray['mp'] = $addItem;
         } else {
             if (strstr($key, '_CTRL_')) {
                 $rndArray['ctrl'] = $addItem;
             } else {
                 $rndArray['cmp'][] = $addItem;
             }
         }
     }
     $viewRenderer->assignVar('renderedItems', array('items' => $rndArray, 'count' => count(OW_Renderable::getRenderedClasses()) - 2));
     $queryLog = OW::getDbo()->getQueryLog();
     foreach ($queryLog as $key => $query) {
         if (isset($_GET['pr_query_log_filter']) && strlen($_GET['pr_query_log_filter']) > 3) {
             if (!strstr($query['query'], $_GET['pr_query_log_filter'])) {
                 unset($queryLog[$key]);
                 continue;
             }
         }
         if ($query['params'] && is_array($query['params'])) {
             $queryLog[$key]['params'] = var_export($query['params'], true);
         }
     }
     $viewRenderer->assignVar('database', array('qet' => OW::getDbo()->getTotalQueryExecTime(), 'ql' => $queryLog, 'qc' => count($queryLog)));
     //events
     $eventsData = OW::getEventManager()->getLog();
     $eventsDataToAssign = array('bind' => array(), 'calls' => array());
     foreach ($eventsData['bind'] as $eventName => $listeners) {
         $listenersList = array();
         foreach ($listeners as $priority) {
             foreach ($priority as $listener) {
                 if (is_array($listener)) {
                     if (is_object($listener[0])) {
                         $listener = get_class($listener[0]) . ' -> ' . $listener[1];
                     } else {
                         $listener = $listener[0] . ' :: ' . $listener[1];
                     }
                 }
                 $listenersList[] = $listener;
             }
         }
         $eventsDataToAssign['bind'][] = array('name' => $eventName, 'listeners' => $listenersList);
     }
     foreach ($eventsData['call'] as $eventItem) {
         $listenersList = array();
         foreach ($eventItem['listeners'] as $priority) {
             foreach ($priority as $listener) {
                 if (is_array($listener)) {
                     if (is_object($listener[0])) {
                         $listener = get_class($listener[0]) . ' -> ' . $listener[1];
                     } else {
                         $listener = $listener[0] . ' :: ' . $listener[1];
                     }
                 }
                 $listenersList[] = $listener;
             }
         }
         $eventsDataToAssign['call'][] = array('type' => $eventItem['type'], 'name' => $eventItem['event']->getName(), 'listeners' => $listenersList, 'params' => var_export($eventItem['event']->getParams(), true), 'start' => sprintf('%.3f', $eventItem['start']), 'exec' => sprintf('%.3f', $eventItem['exec']));
     }
     $eventsDataToAssign['bindsCount'] = count($eventsDataToAssign['bind']);
     $eventsDataToAssign['callsCount'] = count($eventsDataToAssign['call']);
     $viewRenderer->assignVar('events', $eventsDataToAssign);
     $output = $viewRenderer->renderTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'dev_tools_tpl.html');
     $viewRenderer->clearAssignedVars();
     $viewRenderer->assignVars($prevVars);
     $event->add($output);
 }
Пример #4
0
 /**
  * Sets developer mode.
  * 
  * @param boolean $mode 
  */
 public static function setDevMode($mode)
 {
     self::$devMode = (bool) $mode;
 }
Пример #5
0
 public function render()
 {
     $this->consoleItem->setControl(parent::render());
     return $this->consoleItem->render();
 }
Пример #6
0
 public function __construct(OW_Renderable $rendrable)
 {
     parent::__construct('page-add-form');
     $titleTextField = new TextField('title');
     $titleTextField->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_page_title'))->addAttribute('class', 'ow_text');
     $titleTextField->setId('title');
     $isLocal = true;
     if (OW::getRequest()->isPost()) {
         $isLocal = $_POST['type'] == 'local' ? true : false;
     }
     $titleTextField->addValidator(new PageTitleValidator());
     $this->addElement($titleTextField);
     $nameTextField = new TextField('name');
     $nameTextField->setLabel(OW::getLanguage()->text('admin', 'pages_add_menu_name'))->setRequired(true)->addAttribute('class', 'ow_text');
     $this->addElement($nameTextField);
     $visibleForCheckboxGroup = new CheckboxGroup('visible-for');
     $opts = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members'));
     $visibleForCheckboxGroup->setOptions($opts);
     $visibleForCheckboxGroup->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for'));
     $this->addElement($visibleForCheckboxGroup);
     $metaTagsTextarea = new Textarea('meta-tags');
     $metaTagsTextarea->setLabel('Page meta tags')->setId('meta-tags')->setDescription(OW::getLanguage()->text('admin', 'pages_page_field_meta_desc'));
     $this->addElement($metaTagsTextarea);
     $contentTextArea = new Textarea('content');
     $contentTextArea->setLabel(OW::getLanguage()->text('admin', 'pages_add_page_content'))->setId('content')->setDescription(OW::getLanguage()->text('admin', 'pages_page_field_content_desc', array('src' => OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl() . 'question.png', 'url' => '#')));
     $this->addElement($contentTextArea);
     $typeHiddenField = new TextField('type');
     $type = OW::getRequest()->isPost() && $_POST['type'] ? $_POST['type'] : 'local';
     $rendrable->assign('isLocal', $isLocal);
     $typeHiddenField->setValue($type);
     $typeHiddenField->setId('type');
     $typeHiddenField->setLabel(OW::getLanguage()->text('admin', 'page_add_page_address'));
     $this->addElement($typeHiddenField);
     $localUrlTextField = new TextField('local-url');
     $localUrlTextField->addValidator(new LocalPageUrlValidator())->addValidator(new LocalPageUniqueValidator());
     $localUrlTextField->setId('url1');
     $this->addElement($localUrlTextField);
     $externalUrl = new TextField('external-url');
     $externalUrl->setInvitation('http://www.example.com')->setHasInvitation(true)->addValidator(new ADMIN_CLASS_ExternalPageUrlValidator())->setId('url2');
     $this->addElement($externalUrl);
     $extOpenInNewWindow = new CheckboxField('ext-open-in-new-window');
     $extOpenInNewWindow->setLabel(OW::getLanguage()->text('admin', 'pages_edit_external_url_open_in_new_window'));
     $this->addElement($extOpenInNewWindow);
     $submit = new Submit('submit');
     $this->addElement($submit->setValue(OW::getLanguage()->text('base', 'pages_add_submit')));
 }
Пример #7
0
 public function render()
 {
     $this->assign('item', array('key' => $this->getKey(), 'class' => $this->getClass(), 'content' => $this->content));
     return parent::render();
 }
Пример #8
-1
 public function render()
 {
     if ($this->getTemplate() === null) {
         try {
             $plugin = OW::getPluginManager()->getPlugin(OW::getAutoloader()->getPluginKey(get_class($this)));
         } catch (InvalidArgumentException $e) {
             $plugin = null;
         }
         if ($plugin !== null) {
             $template = OW::getAutoloader()->classToFilename(get_class($this), false);
             $this->setTemplate($plugin->getCmpViewDir() . $template . '.html');
         }
     }
     return parent::render();
 }