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


PHP View::factory方法代码示例

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


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

示例1: action_archivos

 public function action_archivos()
 {
     $tipo = $_GET['tipo'];
     $proceso = $_GET['proceso'];
     $archivos = ORM::factory('aarchivos')->where('central_id', '=', $tipo)->and_where('proceso_id', '=', $proceso)->find_all();
     $this->template->content = View::factory('archivero/reportes/result_archivo')->bind('archivos', $archivos);
 }
开发者ID:sysdevbol,项目名称:entidad,代码行数:7,代码来源:reportesmodalidad.php

示例2: error_messages

 public static function error_messages($errors = array())
 {
     if (empty($errors)) {
         return PHP_EOL;
     }
     return View::factory('common/errors')->set('errors', $errors) . PHP_EOL;
 }
开发者ID:TdroL,项目名称:hurtex,代码行数:7,代码来源:html.php

示例3: before

 public function before()
 {
     if ($this->auto_render) {
         $hostArr = explode('.', $_SERVER['HTTP_HOST']);
         $preDomain = $hostArr[0];
         $site = ORM::factory('Site')->where('domain', '=', $preDomain)->find();
         if ($site->loaded()) {
             $this->siteId = $site->id;
             $this->category = ORM::factory('Category')->getAll($site->id, Model_Category::STATUS_SHOW);
             $site = $site->as_array();
             $site['logo'] = '/media/image/data/' . $site['logo'];
             $site['category'] = $this->category;
             $site['author'] = '简站(Simple-Site.cn) - 免费建站、微信网站、免费微信网站!';
             $site['copyright'] = 'Copyright © 2015 SimpleSite. All Rights Reserved';
             $site['friendLinks'] = ORM::factory('FriendLink')->getAll($site['id']);
             $this->theme = "themes/{$site['theme']}/";
             $this->template = View::factory($this->theme . 'base');
             foreach ($site as $key => $value) {
                 View::bind_global($key, $site[$key]);
             }
         } else {
             echo '404';
             exit;
         }
     }
 }
开发者ID:wangyandong,项目名称:SimpleSite,代码行数:26,代码来源:Base.php

示例4: __toString

 public function __toString()
 {
     $s = '';
     if (Sourcemap_Form::$use_templates) {
         try {
             $s = (string) View::factory($this->_template, array('field' => $this));
         } catch (Exception $e) {
             $s = $e->getMessage();
         }
     } else {
         if ($this->_label) {
             $s = $this->_makeLabel();
         }
         if ($this->errors()) {
             $this->add_class('error');
         }
         $s .= $this->_makeInput();
         if ($err = $this->errors()) {
             $s .= "\n" . '<div class="error preserve">' . $err . '</div>';
         }
         if ($this->errors()) {
             $this->remove_class('error');
         }
         $s .= "\n<div class=\"clear\"></div>\n";
     }
     return $s;
 }
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:27,代码来源:field.php

示例5: button

 /**
  * generates HTML for apy buton
  * @param  Model_Order $order 
  * @return string                 
  */
 public static function button(Model_Order $order)
 {
     if (Core::config('payment.paymill_private') != '' and Core::config('payment.paymill_public') != '' and Theme::get('premium') == 1 and $order->loaded()) {
         return View::factory('pages/paymill/button', array('order' => $order));
     }
     return '';
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:12,代码来源:paymill.php

示例6: action_login

 public function action_login()
 {
     // Проверям, вдруг пользователь уже зашел
     if (Auth::instance()->logged_in()) {
         // И если это так, то отправляем его сразу на страницу администратора
         return $this->request->redirect('member');
     }
     // Если же пользователь не зашел, но данные на страницу пришли, то:
     if ($_POST) {
         // Создаем переменную, отвечающую за связь с моделью данных User
         $user = ORM::factory('user');
         // в $status помещаем результат функции login
         $status = Auth::instance()->login($_POST['username'], $_POST['password']);
         // Если логин успешен, то
         if ($status) {
             // Отправляем пользователя на его страницу
             $this->request->redirect('member');
         } else {
             // Иначе ничего не получилось, пишем failed
             $this->template->messages['err_msg'] = 'Ошибка входа!';
         }
     }
     // Грузим view логина
     $this->template->content = View::factory(URL::site('login'));
 }
开发者ID:01vadim10,项目名称:slot_automat,代码行数:25,代码来源:member.php

示例7: action_update

 /**
  * Update new forum
  */
 public function action_update()
 {
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit Topic')));
     $topic = new Model_Topic($this->request->param('id'));
     $get_all = Model_Forum::get_all();
     //get all forums to build forum parents in select
     $forum_parents = array();
     foreach ($get_all[0] as $parent) {
         $forum_parents[$parent['id']] = $parent['name'];
     }
     $this->template->content = View::factory('oc-panel/pages/forum/topic', array('topic' => $topic, 'forum_parents' => $forum_parents));
     if ($_POST) {
         $topic->title = core::post('title');
         $topic->id_forum = core::post('id_forum');
         $topic->description = core::post('description');
         if (core::post('seotitle') != $topic->seotitle) {
             $topic->seotitle = $topic->gen_seotitle(core::post('seotitle'));
         }
         if (core::post('status') == 'on') {
             $topic->status = 1;
         } else {
             $topic->status = 0;
         }
         try {
             $topic->save();
             Alert::set(Alert::SUCCESS, __('Topic is updated.'));
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'topic', 'action' => 'index')));
     }
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:35,代码来源:topic.php

示例8: action_show

 /**
  * 显示日志详细
  * 
  * @param $blog_id 日志编号
  */
 public function action_show($blog_id)
 {
     $model = Model::factory('blog');
     $view = View::factory('pages/blog/show.php');
     $view->blog_info = $model->get_blog_info($blog_id);
     $this->template->content = $view;
 }
开发者ID:un44444444,项目名称:chenwei,代码行数:12,代码来源:blog.php

示例9: action_index

	public function action_index()
	{
		$jobs = ORM::factory('job');
		
		$this->request->response = View::factory('rss')
			->set('jobs', $jobs->order_by('created', 'DESC')->find_all());
	}
开发者ID:rdenmark,项目名称:kohanajobs,代码行数:7,代码来源:rss.php

示例10: action_seo

 public function action_seo()
 {
     if ($this->request->method() == 'POST') {
         $groups = $this->request->post('groups');
         foreach ($groups as $group => $items) {
             foreach ($items as $id => $fields) {
                 $o = ORM::factory('Seo')->where('model', '=', ucfirst($group))->where('pk', '=', $id)->find();
                 if (!$o->loaded()) {
                     $o = ORM::factory('Seo');
                     $o->model = ucfirst($group);
                     $o->pk = $id;
                 }
                 foreach ($fields as $k => $v) {
                     $o->{$k} = $v;
                 }
                 $o->save();
             }
         }
     }
     $groups = array();
     foreach (Kohana::$config->load('seo') as $group => $title) {
         $groups[$group] = array('title' => $title, 'items' => ORM::factory(ucfirst($group))->find_all());
     }
     $this->template->content = View::factory('control/seo', array('groups' => $groups));
 }
开发者ID:jfhs,项目名称:amato-seo,代码行数:25,代码来源:Seo.php

示例11: action_index

 public function action_index()
 {
     //template header
     $this->template->title = '';
     // $this->template->meta_keywords    = 'keywords';
     $this->template->meta_description = Core::config('general.site_description');
     //setting main view/template and render pages
     // swith to decide on ads_in_home
     $ads = new Model_Ad();
     $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED);
     switch (core::config('advertisement.ads_in_home')) {
         case 2:
             $id_ads = array_keys(Model_Visit::popular_ads());
             if (count($id_ads) > 0) {
                 $ads->where('id_ad', 'IN', $id_ads);
             }
             break;
         case 1:
             $ads->where('featured', 'IS NOT', NULL)->where('featured', 'BETWEEN', array(DB::expr('NOW()'), Date::unix2mysql(time() + core::config('payment.featured_days') * 24 * 60 * 60)))->order_by('featured', 'desc');
             break;
         case 0:
         default:
             $ads->order_by('published', 'desc');
             break;
     }
     //if ad have passed expiration time dont show
     if (core::config('advertisement.expire_date') > 0) {
         $ads->where(DB::expr('DATE_ADD( published, INTERVAL ' . core::config('advertisement.expire_date') . ' DAY)'), '>', DB::expr('NOW()'));
     }
     $ads = $ads->limit(Theme::get('num_home_latest_ads', 4))->cached()->find_all();
     $this->ads = $ads;
     $categs = Model_Category::get_category_count();
     $this->template->bind('content', $content);
     $this->template->content = View::factory('pages/home', array('ads' => $ads, 'categs' => $categs));
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:35,代码来源:home.php

示例12: render

 public function render()
 {
     $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('lecture', $lecture)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
     if ($this->action == 'add') {
         $lecture = ORM::factory('lecture', $this->respective_id);
         if ($this->check_deleted($lecture)) {
             return View::factory('feed/unavaliable')->render();
         }
     } else {
         if ($this->action == 'canceled') {
             $lecture = Model_Lecture::get_lecture_from_event($this->respective_id);
             $event = ORM::factory('event', $this->respective_id);
             if ($this->check_deleted($lecture)) {
                 return View::factory('feed/unavaliable')->render();
             }
             $view->bind('event', $event);
         }
     }
     $user = ORM::factory('user', $this->actor_id);
     $span = Date::fuzzy_span($this->time);
     $feed_id = $this->id;
     $curr_user = Auth::instance()->get_user();
     $role = $curr_user->role()->name;
     $comment = ORM::factory('feedcomment');
     $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
     $comments = $comment->find_all();
     $url = Url::site('profile/view/id/');
     return $view->render();
 }
开发者ID:hemsinfotech,项目名称:kodelearn,代码行数:29,代码来源:lecture.php

示例13: before

 public function before()
 {
     parent::before();
     $this->session = Session::instance();
     # Check user authentication
     $auth_result = true;
     $action_name = Request::instance()->action;
     if (array_key_exists($action_name, $this->auth)) {
         $auth_result = $this->_check_auth($action_name);
     } else {
         if (array_key_exists('*', $this->auth)) {
             $auth_result = $this->_check_auth('*');
         }
     }
     if (!$auth_result) {
         if (Auth::instance()->logged_in()) {
             //! \todo Flash message.
             Request::instance()->redirect('user');
         } else {
             Request::instance()->redirect('login');
         }
     }
     // Try to pre-fetch the template. Doesn't have to succeed.
     try {
         $this->template->content = View::factory(Request::instance()->controller . '/' . Request::instance()->action);
     } catch (Kohana_View_Exception $e) {
     }
     $this->template->title = ucwords(Request::instance()->action);
     $this->template->left = null;
     $this->template->right = null;
     $this->template->footer = null;
     $this->template->no_back_button = true;
     $this->template->menu = array();
 }
开发者ID:jmhobbs,项目名称:Sanity,代码行数:34,代码来源:site.php

示例14: action_edit

 /**
  * Edit company
  */
 public function action_edit()
 {
     $id = $this->request->param('id');
     $company = Model::factory('Company');
     $view = View::factory('company/edit');
     switch ($this->request->method()) {
         default:
         case 'GET':
             // Load values
             if (($post = $company->load($id)) === FALSE) {
                 throw HTTP_Exception::factory(404, 'File not found!');
             }
             $view->set('post', $post);
             $view->set('referrer', $this->request->referrer());
             $this->response->body($view);
             break;
         case 'POST':
             $post = $this->request->post();
             if ($company->validate($post)) {
                 $company->save($post, $id);
                 Lasku::flash("Company data is updated.");
                 $this->redirect('company/profile');
             } else {
                 $view->set('post', $post);
                 $view->set('referrer', $post['referrer']);
                 $view->set('errors', $company->errors());
                 $this->response->body($view);
             }
             break;
     }
 }
开发者ID:stwns,项目名称:lasku,代码行数:34,代码来源:Company.php

示例15: action_list

 /**
  * 账号列表
  */
 public function action_list()
 {
     $total = Model::factory('Account')->countAccounts()->getArray();
     $pagination = Pagination::factory($total);
     $accounts = Model::factory('Account')->getAccountsByLimit($pagination->offset(), $pagination->number())->getObject();
     $this->_default->content = View::factory('account/list')->set('accounts', $accounts)->set('pagination', $pagination);
 }
开发者ID:panchao1,项目名称:cronsystem,代码行数:10,代码来源:Account.php


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