Example #1
0
 public function render($file = NULL)
 {
     if ($file !== NULL) {
         $this->set_filename($file);
     }
     if (empty($this->_file)) {
         throw new Exception('You must set the file to use within your view before rendering');
     }
     return View::capture($this->_file, $this->_data);
 }
Example #2
0
 public function render($file = NULL)
 {
     if ($file !== NULL) {
         $this->set_filename($file);
     }
     if (empty($this->_file)) {
         throw new View_Exception('You must set the file to use within your view before rendering');
     }
     $extension = pathinfo($this->_file, PATHINFO_EXTENSION);
     if ($extension == 'mustache') {
         $this->_file = $this->_tmpl;
     }
     // Combine local and global data and capture the output
     return View::capture($this->_file, $this->_data, $extension);
 }
Example #3
0
 public function render($file = NULL, array $data = NULL)
 {
     Kohana::$profiling === TRUE && ($bm = Profiler::start('View', __FUNCTION__));
     if ($file !== NULL) {
         $this->set_filename($file);
     }
     if (is_array($data) || $data instanceof Traversable) {
         $this->set($data);
     }
     if (!$this->_file || !is_file($this->_file)) {
         throw new View_Exception('The requested view :file could not be found', [':file' => $this->_origfile]);
     }
     $result = View::capture($this->_file, $this->_data);
     isset($bm) && Profiler::stop($bm);
     return $result;
 }
Example #4
0
File: view.php Project: azuya/Wi3
 /**
  * Renders the view object to a string. Global and local data are merged
  * and extracted to create local variables within the view file.
  *
  *     $output = $view->render();
  *
  * [!!] Global variables with the same key name as local variables will be
  * overwritten by the local variable.
  *
  * @param    string  view filename
  * @return   string
  * @throws   Kohana_View_Exception
  * @uses     View::capture
  */
 public function render($file = NULL)
 {
     if ($file !== NULL) {
         $this->set_filename($file);
     }
     if (empty($this->_file)) {
         throw new Kohana_View_Exception('You must set the file to use within your view before rendering');
     }
     // Combine local and global data and capture the output
     // Capture is dependent on the 'this' parameter
     // If it is present, then render this view through that object
     if (isset($this->this) and !empty($this->this) and is_object($this->this)) {
         return $this->this->capture($this->_file, $this->_data);
     } else {
         return View::capture($this->_file, $this->_data);
     }
 }
Example #5
0
 /**
  * Renders the view object to a string. Global and local data are merged
  * and extracted to create local variables within the view file.
  *
  *     $output = $view->render();
  *
  * [!!] Global variables with the same key name as local variables will be
  * overwritten by the local variable.
  *
  * @param   string  $file   view filename
  * @return  string
  * @throws  View_Exception
  * @uses    View::capture
  */
 public function render($file = NULL)
 {
     if ($file !== NULL) {
         $this->set_filename($file);
     }
     if (empty($this->_file)) {
         throw new View_Exception('You must set the file to use within your view before rendering');
     }
     // Combine local and global data and capture the output
     return View::capture($this->_file, $this->_data);
 }
Example #6
0
 public function render($print = true)
 {
     if (empty($this->_file)) {
         throw new Exception('You must set the file to use within your view before rendering');
     }
     // Combine local and global data and capture the output
     $output = View::capture($this->_file, $this->_data);
     if ($print) {
         echo $output;
     } else {
         return $output;
     }
 }
Example #7
0
 function namebar()
 {
     $channel = DB::get()->val('SELECT name FROM channels WHERE user_id = :user_id AND active = 1', array('user_id' => Auth::user_id()));
     $names = DB::get()->results("\n\t\t\tselect\n\t\t\t\tchannels.name,\n\t\t\t\tusers.id,\n\t\t\t\tusers.username,\n\t\t\t\tusers.lastping,\n\t\t\t\tsessions.pingtime,\n\t\t\t\tchannels.last,\n\t\t\t\tchannels.active,\n\t\t\t\tnick.value as nickname,\n\t\t\t\tstat.value as status,\n\t\t\t\tcoalesce(timestampdiff(SECOND, sessions.pingtime, CURRENT_TIMESTAMP) < 65) as loggedin\n\t\t\tfrom users\n\t\t\tLEFT JOIN options nick\n\t\t\t\tON\n\t\t\t\t\tnick.user_id = users.id\n\t\t\t\t\tAND nick.name = 'Nickname'\n\t\t\t\t\tAND nick.grouping = 'Identity'\n\t\t\tLEFT JOIN options stat\n\t\t\t\tON\n\t\t\t\t\tstat.user_id = users.id\n\t\t\t\t\tAND stat.name = 'Status'\n\t\t\t\t\tAND stat.grouping = 'Identity'\n\t\t\tleft join sessions\n\t\t\t\ton\n\t\t\t\t\tsessions.user_id = users.id\n\t\t\tleft join channels\n\t\t\t\ton\n\t\t\t\t\tusers.id = channels.user_id\n\t\t\tand\n\t\t\t\tchannels.name = :channel\n\t\t\twhere users.id > 0\n\t\t\tORDER by loggedin DESC, active DESC, username ASC;\n\t\t", array('channel' => $channel));
     foreach ($names as $k => $name) {
         $names[$k]->channels = DB::get()->col("SELECT coalesce(value, channels.name) FROM channels left join options on options.room = channels.name and options.grouping = 'Rooms' and options.name = 'alias' WHERE channels.user_id = :user_id", array('user_id' => $name->id));
     }
     $yourein = DB::get()->col("SELECT coalesce(value, channels.name) FROM channels left join options on options.room = channels.name and options.grouping = 'Rooms' and options.name = 'alias' WHERE channels.user_id = :user_id", array('user_id' => Auth::user_id()));
     $components['names'] = $names;
     $components['yourein'] = $yourein;
     $v = new View($components);
     return $v->capture('namebar');
 }
Example #8
0
File: view.php Project: ukd1/kohana
 /**
  * Renders the view object to a string. Global and local data are merged
  * and extracted to create local variables within the view file.
  * Optionally, the view filename can be set before rendering.
  *
  * @throws   Kohana_Exception
  * @param    string  filename
  * @return   string
  */
 public function render($file = NULL)
 {
     if (!empty($file)) {
         $this->set_filename($file);
     }
     if (empty($this->_file)) {
         // The user has not specified a view file yet
         throw new Kohana_Exception('No file specified for view, unable to render');
     }
     // Combine global and local data. Global variables with the same name
     // will be overwritten by local variables.
     $data = array_merge(View::$_global_data, $this->_data);
     return View::capture($this->_file, $data);
 }
Example #9
0
 /**
  * Renders the view object to a string. Global and local data are merged
  * and extracted to create local variables within the view file.
  * Optionally, the view filename can be set before rendering.
  *
  * @throws   Kohana_Exception
  * @param    string  filename
  * @return   string
  */
 public function render($file = NULL)
 {
     if (!empty($file)) {
         $this->set_filename($file);
     }
     if (empty($this->file)) {
         throw new Kohana_Exception('kohana.view.set_filename');
     }
     // Combine global and local data. Global variables with the same name
     // will be overwritten by local variables.
     $data = array_merge(View::$global_data, $this->data);
     return View::capture($this->file, $data);
 }
Example #10
0
 /**
  * Renders the view object to a string. Global and local data are merged
  * and extracted to create local variables within the view file.
  *
  * Note: Global variables with the same key name as local variables will be
  * overwritten by the local variable.
  *
  * @throws   View_Exception
  * @param    view filename
  * @return   string
  */
 public function render($file = NULL)
 {
     if ($file !== NULL) {
         $this->set_filename($file);
     }
     if (empty($this->_file)) {
         throw new Kohana_View_Exception('You must set the file to use within your view before rendering');
     }
     // Combine global and local data. Global variables with the same name
     // will be overwritten by local variables.
     $data = array_merge(View::$_global_data, $this->_data);
     return View::capture($this->_file, $data);
 }