当前位置: 首页>>代码示例>>PHP>>正文


PHP Lib::view方法代码示例

本文整理汇总了PHP中Lib::view方法的典型用法代码示例。如果您正苦于以下问题:PHP Lib::view方法的具体用法?PHP Lib::view怎么用?PHP Lib::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lib的用法示例。


在下文中一共展示了Lib::view方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main

 public function main()
 {
     $pageview = Lib::view('page');
     $pages = $pageview->getPages();
     $this->set('pageview', $pageview);
     $this->set('pages', $pages);
 }
开发者ID:jasonrey,项目名称:lab-page,代码行数:7,代码来源:index.php

示例2: filter

 public function filter()
 {
     $keys = array('state', 'assignee', 'sort', 'project');
     if (!Req::haspost($keys)) {
         return $this->fail('Insufficient data.');
     }
     $identifier = Lib::cookie(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     if (!$isLoggedIn) {
         return $this->fail('You are not authorized.');
     }
     $post = Req::post($keys);
     $projectTable = Lib::table('project');
     if ($post['project'] !== 'all' && !$projectTable->load(array('name' => $post['project']))) {
         return $this->fail('No such project.');
     }
     $cookie = Lib::cookie();
     foreach ($keys as $key) {
         $cookie->set('filter-' . $key, $post[$key]);
     }
     $reportModel = Lib::model('report');
     $reports = $reportModel->getItems(array('state' => constant('STATE_' . strtoupper($post['state'])), 'assignee_id' => $post['assignee'], 'order' => 'date', 'direction' => $post['sort'], 'project_id' => $projectTable->id));
     $userModel = Lib::model('user');
     $assignees = $userModel->getProjectAssignees($projectTable->id);
     $html = '';
     $view = Lib::view('embed');
     foreach ($reports as $report) {
         $html .= $view->loadTemplate('report-item', array('report' => $report, 'assignees' => $assignees, 'user' => $user));
     }
     return $this->success($html);
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:32,代码来源:report.php

示例3: foreach

			<span class="menu-button-line line-bottom"></span>
		</div>
	</div>
	<ul class="menu-items">
		<li class="menu-item menu-item-index"><a class="menu-item-link <?php 
if ($viewname === 'index') {
    ?>
active<?php 
}
?>
" href="<?php 
echo Lib::url('index');
?>
">Index</a></li>
		<?php 
foreach (Lib::view('page')->getPages() as $pageslug => $page) {
    ?>
		<li class="menu-item"><a class="menu-item-link <?php 
    if ($viewname === 'page' && $pageslug === $slug) {
        ?>
active<?php 
    }
    ?>
" href="<?php 
    echo Lib::url('page', array('slug' => $pageslug));
    ?>
"><?php 
    echo $page->title;
    ?>
</a></li>
		<?php 
开发者ID:jasonrey,项目名称:lab-page,代码行数:31,代码来源:menu.php

示例4: output

 public static function output($namespace, $vars = array())
 {
     $segments = explode('/', $namespace);
     $view = array_shift($segments);
     $path = implode('/', $segments);
     $class = Lib::view($view);
     $class->set($vars);
     return $class->output($path);
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:9,代码来源:lib.php

示例5: sync

 public function sync()
 {
     if (!Req::haspost('reports', 'ids')) {
         return $this->fail('Insufficient data.');
     }
     $identifier = Lib::cookie(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     if (!$isLoggedIn) {
         return $this->fail('You are not authorized.');
     }
     $reports = json_decode(Req::post('reports'));
     $ids = Req::post('ids');
     $updated = array();
     $commentModel = Lib::model('comment');
     $comments = $commentModel->getComments(array('report_id' => $ids));
     $commentsByReportId = array();
     foreach ($comments as $comment) {
         $commentsByReportId[$comment->report_id][$comment->id] = $comment;
     }
     foreach ($reports as $id => $report) {
         $newTotalComments = empty($commentsByReportId[$id]) ? 0 : count($commentsByReportId[$id]);
         if ($report->totalComments == $newTotalComments) {
             continue;
         }
         $updated[$id] = array('totalComments' => $newTotalComments, 'comments' => array());
         if (!$report->commentsLoaded) {
             continue;
         }
         $view = Lib::view('embed');
         foreach ($commentsByReportId[$id] as $commentid => $newComment) {
             if (in_array($commentid, $report->comments)) {
                 $updated[$id]['comments'][$commentid] = false;
                 continue;
             }
             $updated[$id]['comments'][$commentid] = $view->loadTemplate('comment-item', array('comment' => $comment, 'user' => $user));
         }
     }
     return $this->success($updated);
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:40,代码来源:comment.php

示例6: route

 public function route($segments = array())
 {
     $result = $this->decode($segments);
     $view = Lib::view($this->key);
     $view->display();
 }
开发者ID:jasonrey,项目名称:lab-page,代码行数:6,代码来源:router.php


注:本文中的Lib::view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。