Exemplo n.º 1
0
 public function show($id)
 {
     // Получаем ряд
     $id = intval($id);
     $this->nId = $id;
     try {
         // Получаем детей
         $aChild = Sitemap::selectChild($id);
         if ($id != 0) {
             $aRow = Sitemap_Sample::get($id);
         } else {
             $aRow = null;
         }
         /*$aData = array();
         		foreach ($aChild as $row)
         		{
         			$aData[] = $row['id'];
         		}*/
         $aData = $aChild;
         //
         $this->formatDesign($aRow);
         // Выводим форму сортировки
         print UParser::parsePHPFile(LIB_PATH . 'sitemap/controller/tpl/order.tpl', array('szTitle' => $this->szTitle, 'aBegin' => $this->aBegin, 'id' => $id, 'back' => $this->back, 'aData' => $aData));
         $this->output();
     } catch (SiteMapException $e) {
         $this->addError(_msg('Ряд не найден в бд'));
         $this->jump('./');
     }
 }
Exemplo n.º 2
0
 public function generate()
 {
     $fullGrantList = $this->getAllGrantsMap();
     $grantList = ACL::selectAllGrantsForEntity($this->entity);
     $tpl = __DIR__ . DIRECTORY_SEPARATOR . 'form.tpl';
     $parseData = array('name' => $this->szName, 'grantList' => $grantList, 'fullGrantList' => $fullGrantList);
     return UParser::parsePHPFile($tpl, $parseData);
 }
Exemplo n.º 3
0
 /**
  * Генерирует html-представление контрола
  */
 public function generate()
 {
     $values = array();
     foreach ($this->values as $key => $row) {
         $values[] = array($key, $row);
     }
     $aParse = array('name' => $this->szName, 'title' => $this->title, 'values' => $values);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/key_value_list.tpl', $aParse);
 }
Exemplo n.º 4
0
 public function generate()
 {
     // Проверяем есть ли адрес скрипта
     if (empty($this->url)) {
         throw new Exception('Url not defined');
     }
     $parseData = array('name' => $this->szName, 'values' => $this->values, 'url' => $this->url);
     return UParser::parsePHPFile(dirname(__FILE__) . '/tpl/links_to_many.tpl', $parseData);
 }
Exemplo n.º 5
0
 public function getAdminFormValue()
 {
     //
     //
     //
     $strings = \CMS_Strings::getInstance();
     $aParse = array('lang' => $strings->language, 'aTableHeader' => $this->fieldInfo['columns'], 'aData' => $this->aValue, 'szName' => $this->szFieldName, 'szComment' => '');
     return UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'table/admin-form.tpl', $aParse);
 }
Exemplo n.º 6
0
 /**
  * @desc Выводит форму для редактирования даты
  * @return
  */
 function getFormValue()
 {
     // Выдираем текущий год, месяц и день
     $aDate = preg_split('#[ \\:\\-]#', $this->aValue);
     // Подготавливаем массив для парсинга
     $aParse = array('current_year' => $aDate[0], 'current_month' => $aDate[1], 'current_day' => $aDate[2], 'current_hour' => $aDate[3], 'current_minute' => $aDate[4], 'fieldname' => $this->szFieldName, 'value' => $aDate[0] . '-' . intval($aDate[1]) . '-' . $aDate[2] . ' ' . intval($aDate[3]) . ':' . intval($aDate[4]));
     // Парсим
     $szResult = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'datetime/form.tpl', $aParse);
     return $szResult;
 }
Exemplo n.º 7
0
 public function generate()
 {
     $parseData = array('name' => $this->id, 'value' => $this->src, 'imageInfo' => array('size' => 0, 'width' => 0, 'height' => 0));
     if (!empty($this->src) && file_exists(WEBROOT_PATH . $this->src)) {
         $path = WEBROOT_PATH . $this->src;
         $imageInfo = getimagesize($path);
         $parseData['imageInfo'] = array('size' => $this->format_bytes($path), 'width' => $imageInfo[0], 'height' => $imageInfo[1]);
     }
     return UParser::parsePHPFile(dirname(__FILE__) . '/tpl/image.tpl', $parseData);
 }
Exemplo n.º 8
0
 public function generate()
 {
     if (!empty($this->value)) {
         $urlInfo = Sitemap_Sample::get($this->value);
     } else {
         $urlInfo = array();
     }
     $parseData = array('name' => $this->szName, 'filter' => $this->filter, 'urlInfo' => $urlInfo);
     return UParser::parsePHPFile(LIB_PATH . 'sitemap/control/select.once.tpl', $parseData);
 }
Exemplo n.º 9
0
 /**
  * @desc
  * @return
  */
 public function getAdminFormValue()
 {
     // �������� ������ ��������
     $aParse = array();
     $aParse['value'] = $this->aValue;
     $aParse['name'] = $this->szFieldName;
     $aParse['id'] = $this->document->id->getValue();
     // ������
     $szResult = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'file/form.tpl', $aParse);
     // ���������� ���������
     return $szResult;
 }
Exemplo n.º 10
0
 public function generate()
 {
     $parseData = array('name' => $this->szName);
     if (!empty($this->currentUserId)) {
         try {
             $user = new UserAccount($this->currentUserId);
             $parseData['currentUser'] = $user->getParseData();
         } catch (Exception $e) {
         }
     }
     return UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'tpl/userselect.tpl', $parseData);
 }
Exemplo n.º 11
0
 public function generate()
 {
     // Получаем сайтмап данные
     $displayValues = array();
     foreach ($this->values as $id) {
         $sitemap = Sitemap_Sample::get($id);
         if (!empty($sitemap)) {
             $displayValues[] = array($sitemap['id'], $sitemap['name'], $sitemap['full_url']);
         }
     }
     $parseData = array('name' => $this->szName, 'values' => $displayValues);
     return UParser::parsePHPFile(LIB_PATH . 'sitemap/control/select.tpl', $parseData);
 }
Exemplo n.º 12
0
 public function main()
 {
     $aType = call_user_func([$this->typeName, 'getFieldsInfo']);
     $szIndex = call_user_func([$this->typeName, 'getIndexKey']);
     $sql = sprintf('select `%s`, `%s` as name, `%s` from `%s` where %s order by `%s` ', $szIndex, $this->fieldName, $this->fieldOrder, $aType['table'], $this->fieldCondition, $this->fieldOrder);
     $aData = \Extasy\ORM\DB::query($sql);
     foreach ($aData as $key => $value) {
         foreach ($value as $key2 => $value2) {
             $aData[$key][$key2] = str_replace("\n", '', $value2);
         }
     }
     print UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'order.tpl', array('szTitle' => $this->szTitle, 'aBegin' => $this->aBegin, 'type' => $this->typeName, 'back' => $this->back, 'aHidden' => $this->aHidden, 'aData' => $aData));
     $this->output();
 }
Exemplo n.º 13
0
 public function getAdminFormValue()
 {
     // Данные для парсинга
     $aParse = array();
     $aParse['name'] = $this->szFieldName;
     $szPath = $this->getPath();
     if (!empty($this->aValue) && file_exists($szPath)) {
         $aInfo = @getimagesize($szPath);
         //
         $aParse['value'] = $this->aValue;
     } else {
         $aParse['value'] = '';
     }
     //
     $szResult = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'simple_image/form.tpl', $aParse);
     return $szResult;
 }
Exemplo n.º 14
0
 /**
  * Генерирует код для вызова js/users_controls/date.js и создания нового поля ввода даты 
  */
 public function generate()
 {
     $aParse = array('name' => $this->szName, 'value' => $this->value);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/date.tpl', $aParse);
 }
Exemplo n.º 15
0
 public function authProc()
 {
     if (!headers_sent()) {
         header('Content-Type: text/html; charset= utf-8');
     }
     $register = new SystemRegister('System/Front-end');
     $techMessage = $register->technical_message->value;
     $template = __DIR__ . DIRECTORY_SEPARATOR . 'login.tpl';
     //
     print UParser::parsePHPFile($template, array('techMessage' => $techMessage));
 }
Exemplo n.º 16
0
 public function getAdminViewValue()
 {
     $parseVariables = array('name' => $this->szFieldName, 'status' => $this->status, 'loadTime' => $this->loadTime, 'errorMessage' => $this->errorMessage);
     return UParser::parsePHPFile(dirname(__FILE__) . '/tpl/resultView.tpl', $parseVariables);
 }
Exemplo n.º 17
0
 /**
  *
  * Enter description here ...
  */
 protected function showAlerts()
 {
     $processAlerts = function ($key, $path) {
         $result = '';
         $messages = !empty($_SESSION[$key]) ? $_SESSION[$key] : [];
         $_SESSION[$key] = [];
         foreach ($messages as $row) {
             $result .= UParser::parsePHPFile($path, array('message' => $row));
         }
         return $result;
     };
     $messages = $processAlerts('__page_alert', VIEW_PATH . 'blocks/Alerts/message.tpl');
     $messages .= $processAlerts(self::ErrorKey, VIEW_PATH . 'blocks/Alerts/error.tpl');
     $this->insertIntoResponse($messages);
 }
Exemplo n.º 18
0
 public function generate()
 {
     $aParse = array('id' => $this->szName . '_id', 'name' => $this->szName, 'value' => $this->szValue);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/file_select.tpl', $aParse);
 }
Exemplo n.º 19
0
 public function getAdminFormValue()
 {
     $tpl = __DIR__ . DIRECTORY_SEPARATOR . 'password/admin-form.tpl';
     $parseData = array('name' => $this->szFieldName, 'forceInput' => empty($this->aValue));
     return UParser::parsePHPFile($tpl, $parseData);
 }
Exemplo n.º 20
0
 public function generate()
 {
     $parseData = array('name' => $this->szName, 'id' => !empty($this->szId) ? $this->szId : 'checkbox_' . $this->szName, 'checked' => $this->szChecked, 'value' => $this->szValue, 'labelTitle' => $this->szTitle);
     $result = UParser::parsePHPFile(CONTROL_PATH . 'tpl/checkbox.tpl', $parseData);
     return $result;
 }
Exemplo n.º 21
0
 public function getFormValue()
 {
     // формируем массив парсинга
     $aParse = array('szFieldName' => $this->szFieldName, 'szFontFile' => $this->szFontFile, 'szValue' => $this->aValue, 'szView' => $this->getViewValue());
     // шаблон
     $szContent = UParser::parsePHPFile(__DIR__ . DIRECTORY_SEPARATOR . 'graphical_text/form.tpl', $aParse);
     return $szContent;
 }
Exemplo n.º 22
0
 public function getControl()
 {
     $strings = CMS_Strings::getInstance();
     $aParse = array('lang' => $strings->language, 'aTableHeader' => $this->aTableHeader, 'aData' => unserialize($this->szContent), 'szName' => $this->szName, 'szComment' => $this->szComment);
     return UParser::parsePHPFile(CONFIG_PATH . 'plugins/array_list/form.tpl', $aParse);
 }
Exemplo n.º 23
0
 public function generate()
 {
     $szResult = '<select class="%s" size="%s" name="%s" id="%s" style="%s">';
     $szResult = sprintf($szResult, $this->class, $this->nSize, $this->szName, !empty($this->szId) ? $this->szId : $this->szName, $this->szStyle);
     $szTemplateOptGroup = '<optgroup label="%s">%s</optgroup>';
     if (!is_array($this->aValues)) {
         throw new Exception('Select control values list must be an arrray');
     }
     if ($this->bUseGroups) {
         foreach ($this->aValues as $row) {
             // Если перед нами группа, то добавляем её
             if (isset($row['options'])) {
                 $szOptions = '';
                 foreach ($row['options'] as $opt) {
                     $szOptions .= self::createOption($opt[$this->valueField], $opt[$this->titleField], $this->nCurrent);
                 }
                 // Если хотя бы одна опция была вставлена в группу, то группа подается на вывод
                 if (!empty($szOptions)) {
                     $szResult .= sprintf($szTemplateOptGroup, htmlspecialchars($row['group-title']), $szOptions);
                 }
             } else {
                 // Просто вставляем код <otpion>
                 $szResult .= self::createOption($row[$this->valueField], $row[$this->titleField], $this->nCurrent);
             }
         }
     } else {
         foreach ($this->aValues as $row) {
             $szResult .= self::createOption($row[$this->valueField], $row[$this->titleField], $this->nCurrent);
         }
     }
     $szResult .= '</select>';
     if (!empty($this->required)) {
         $selector = '#' . (!empty($this->szId) ? $this->szId : $this->szName);
         $errorMsg = $this->required;
         $szResult .= \Faid\UParser::parsePHPFile(__DIR__ . '/tpl/select.tpl', ['selector' => $selector, 'errorMsg' => $errorMsg]);
     }
     return $szResult;
 }
Exemplo n.º 24
0
 public function generate()
 {
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/php_source.tpl', array('name' => $this->szName, 'phpSource' => $this->phpSource, 'initData' => $this->initData));
 }
Exemplo n.º 25
0
 /**
  * (non-PHPdoc)
  * @see \Extasy\Columns\BaseColumn::getAdminFormValue()
  */
 public function getAdminFormValue($onlyResizes = false)
 {
     static $librariesLoaded = false;
     $nId = $this->document->id->getValue();
     if (!empty($nId)) {
         $baseUrl = \Extasy\CMS::getFilesHttpRoot() . $this->getSrc();
         $filePath = \Extasy\CMS::getFilesPath() . $this->getSrc();
         $aPlaceholder = array();
         $aParse = array();
         if ($this->imageExists()) {
             $aSize = getimagesize($filePath);
             $aParse[] = array('url' => $baseUrl, 'size_x' => $aSize[0], 'size_y' => $aSize[1], 'basename' => 'default');
             // Если передан массив images
             $bIsArray = isset($this->fieldInfo['images']) && is_array($this->fieldInfo['images']);
             if ($bIsArray) {
                 foreach ($this->fieldInfo['images'] as $key => $value) {
                     $value = explode('x', $value);
                     if (sizeof($value) == 1) {
                         $w = $h = $value[0];
                     } else {
                         list($w, $h) = $value;
                     }
                     $imageUrl = imageHelper::getTimthumbUrl($baseUrl, $w, $h) . '&rand=' . rand();
                     $aParse[] = array('size_x' => $w, 'size_y' => $h, 'url' => $imageUrl, 'basename' => $key);
                 }
             }
             // setup thumbnail
             $aPlaceholder['thumbnailSrc'] = imageHelper::getTimthumbUrl($baseUrl, self::thumbWidth, self::thumbHeight) . '&rand=' . rand();
         } else {
             $aSize = null;
         }
         $aPlaceholder['aList'] = $aParse;
     }
     $aPlaceholder['name'] = $this->szFieldName;
     $aPlaceholder['value'] = $this->aValue;
     $aPlaceholder['librariesLoaded'] = $librariesLoaded;
     $aPlaceholder['required'] = !empty($this->fieldInfo['required']);
     $aPlaceholder['title'] = !empty($this->fieldInfo['title']) ? $this->fieldInfo['title'] : '';
     if ($onlyResizes) {
         $template = __DIR__ . DIRECTORY_SEPARATOR . 'image/resizes.tpl';
     } else {
         $template = __DIR__ . DIRECTORY_SEPARATOR . 'image/formAdmin.tpl';
     }
     $szResult = UParser::parsePHPFile($template, $aPlaceholder);
     $librariesLoaded = true;
     return $szResult;
 }
Exemplo n.º 26
0
 /**
  * Генерирует результат
  */
 protected static function generate()
 {
     $aParse = array('aMessage' => self::$aDebug, 'aAlert' => self::$aAlert);
     return UParser::parsePHPFile(dirname(__FILE__) . '/template.tpl', $aParse);
 }
Exemplo n.º 27
0
 public function generate()
 {
     $parseData = array('name' => $this->szName, 'content' => $this->szContent, 'title' => !empty($this->title) ? $this->title : $this->szName, 'required' => $this->required);
     return UParser::parsePHPFile(CONTROL_PATH . 'tpl/htmlarea-light.tpl', $parseData);
 }