예제 #1
0
 /**
  * @param $page
  * @return bool|mixed|string
  */
 public function url($page)
 {
     if (is_callable($this->callback)) {
         return call_user_func($this->callback, $page);
     }
     return \TAO\Urls::pagerUrl($this->url, $this->var, $page);
 }
예제 #2
0
파일: tao.php 프로젝트: techart/bitrix.tao
 /**
  * @param $code
  * @return \TAO\Infoblock
  * @throws TAONoInfoblockFileException
  */
 public static function getInfoblock($code)
 {
     if (is_numeric($code)) {
         $code = self::getInfoblockCode($code);
     }
     if (!isset(self::$infoblocks[$code])) {
         $name = \TAO\Infoblock::getClassName($code);
         $e = new $name($code);
         self::$infoblocks[$code] = $e;
         foreach ($e->urls() as $mode => $data) {
             if (isset($data['default']) && isset($data['page'])) {
                 $url = $data['default'];
                 $re = '{^' . str_replace('{id}', '(?<id>\\d+)', $url) . '$}';
                 \TAO\Urls::addDefaultUrl($re, array('infoblock' => $code, 'mode' => $mode, 'default_url' => $url, 'page' => $data['page']));
             }
         }
     }
     return self::$infoblocks[$code];
 }
예제 #3
0
 /**
  * @return bool
  */
 public function isCurrent()
 {
     return \TAO\Urls::isCurrent($this->url);
 }
예제 #4
0
    chdir(dirname($_tao_path));
    unset($uri);
    unset($p);
    unset($m);
    include $_tao_path;
    die;
}
if (isset($GLOBALS['tao_urlrewrited'])) {
    die;
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/local/vendor/techart/bitrix.tao/include/prolog_before.php';
$GLOBALS['tao_urlrewrited'] = true;
$uri = $_SERVER['REQUEST_URI'];
$script = $_SERVER['PHP_SELF'];
chdir($_SERVER['DOCUMENT_ROOT']);
\TAO\Urls::processVars();
$content = \TAO\Bundle::routeBundles();
if (is_string($content)) {
    if (is_string(\TAO::$layout)) {
        $prolog = $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_after.php";
        $epilog = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";
        if (\TAO::$layout == 'admin') {
            $prolog = $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin.php";
            $epilog = $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_admin.php";
        }
        require $prolog;
        if (\TAO::$compositeContent) {
            $frame = \TAO::compositeFrame(\TAO::$compositeContent);
            $stub = trim(\TAO::$compositeStub);
            $stub = strlen($stub) > 0 ? $stub : \TAO::t('composite_loading');
            $frame->begin($stub);
예제 #5
0
 /**
  * @param array $args
  * @return string
  */
 public function render($args = array())
 {
     $code = $this->getMnemocode();
     $itemMode = isset($args['item_mode']) ? $args['item_mode'] : 'teaser';
     $listMode = isset($args['list_mode']) ? $args['list_mode'] : 'default';
     $listClass = isset($args['list_class']) ? $args['list_class'] : "tao-list-{$code}";
     $pagerTop = isset($args['pager_top']) ? $args['pager_top'] : false;
     $pagerBottom = isset($args['pager_bottom']) ? $args['pager_bottom'] : false;
     $count = $this->getCount($args);
     $items = $this->getItems($args);
     if ($count == 0) {
         $path = $this->viewPath("list-empty.phtml", $listMode);
     } else {
         $path = $this->viewPath("list.phtml", $listMode);
     }
     list($order, $filter, $groupBy, $nav, $fields, $other) = $this->convertArgs($args);
     if (isset($other['page']) && isset($other['per_page'])) {
         $pagerVar = $other['pager_var'];
         $page = (int) $other['page'];
         $perPage = (int) $other['per_page'];
         $numPages = ceil($count / $perPage);
         if ($numPages < 2) {
             $pagerTop = false;
             $pagerBottom = false;
         }
     }
     if (isset($args['ajax_url'])) {
         $ajaxUrl = $args['ajax_url'];
     } else {
         $ajaxUrl = '/local/vendor/techart/bitrix.tao/api/elements-ajax.php';
         $urlArgs = $args;
         $urlArgs['infoblock'] = $this->getMnemocode();
         $ajaxUrl = \TAO\Urls::url($ajaxUrl, $urlArgs);
     }
     ob_start();
     include $path;
     $content = ob_get_clean();
     return $content;
 }