コード例 #1
0
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     //Set the correct mime type
     $this->_document->setMimeEncoding('text/plain');
     $this->chart = new KChartOpenflashchart();
 }
コード例 #2
0
ファイル: feed.php プロジェクト: kedweber/com_makundi
 public function display()
 {
     $model = $this->getModel();
     $descendants = array();
     $descendants[] = $model->getItem()->id;
     $config = new KConfig();
     if ($params = JFactory::getApplication()->getMenu()->getActive()->params) {
         $config->append($params->toArray());
     }
     if ($config->show_subcategories) {
         $descendants = array_merge($descendants, $model->getItem()->getDescendants(array('level' => 1))->getColumn('id'));
     }
     $articles = $this->getService('com://site/articles.model.articles')->category_id($descendants)->limit(20)->getList();
     $doc = JFactory::getDocument();
     foreach ($articles as $article) {
         $item = new JFeedItem();
         $item->title = $article->title;
         $item->link = $this->createRoute('option=com_articles&view=article&date=' . date('Y-m-d', strtotime($article->publish_up)) . '&id=' . $article->id . '&slug=' . $article->slug . '&format=html');
         $item->description = $article->introtext;
         $item->date = $article->publish_up;
         $category = json_decode($article->ancestors)->category;
         if (is_numeric($category)) {
             $item->category = $this->getService('com://site/makundi.model.categories')->id($category)->getItem()->title;
         }
         $doc->addItem($item);
     }
     return parent::display();
 }
コード例 #3
0
ファイル: rss.php プロジェクト: JSWebdesign/intranet-platform
 public function display()
 {
     $category = $this->getService('com://site/weblinks.model.categories')->getItem();
     $items = $this->getService('com://site/weblinks.model.weblinks')->catid(KRequest::get('get.id', 'int'))->getList();
     $xml = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
     $xml .= '<rss version="2.0">' . PHP_EOL;
     $xml .= '<channel>' . PHP_EOL;
     $xml .= '	<title>' . $category->title . '</title>' . PHP_EOL;
     $xml .= '	<description><![CDATA[' . $category->description . ']]></description>' . PHP_EOL;
     $xml .= '	<link>' . KRequest::url() . '</link>' . PHP_EOL;
     $xml .= '	<lastBuildDate>' . date('r') . '</lastBuildDate>' . PHP_EOL;
     $xml .= '	<generator>' . JURI::base() . '</generator>' . PHP_EOL;
     $xml .= '	<language>' . JFactory::getLanguage()->getTag() . '</language>' . PHP_EOL;
     foreach ($items as $item) {
         $xml .= '	<item>' . PHP_EOL;
         $xml .= '		<title>' . htmlspecialchars($item->title) . '</title>' . PHP_EOL;
         $xml .= '		<link>' . JURI::base() . JRoute::_('index.php?option=com_weblinks&view=weblink&id=' . $item->id) . '</link>' . PHP_EOL;
         $xml .= '		<guid>' . JURI::base() . JRoute::_('index.php?option=com_weblinks&view=weblink&id=' . $item->id) . '</guid>' . PHP_EOL;
         $xml .= '		<description><![CDATA[' . htmlspecialchars($item->description) . ']]></description>' . PHP_EOL;
         $xml .= '		<category>' . $category->title . '</category>' . PHP_EOL;
         $xml .= '		<pubDate>' . date('r', strtotime($item->date)) . '</pubDate>' . PHP_EOL;
         $xml .= '	</item>' . PHP_EOL;
     }
     $xml .= '</channel>' . PHP_EOL;
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
コード例 #4
0
ファイル: rss.php プロジェクト: ravenlife/Ninjaboard
 public function display()
 {
     $items = $this->getModel()->getList();
     $root = KRequest::url()->get(KHttpUri::PART_BASE ^ KHttpUri::PART_PATH);
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
     $xml .= '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">';
     $xml .= '<channel>';
     $xml .= '<title>Posts RSS feed</title>';
     $xml .= '<description>RSS description</description>';
     $xml .= '<generator>' . JURI::base() . '</generator>';
     foreach ($items as $item) {
         $xml .= '<item>';
         $xml .= '<title>' . htmlspecialchars($item->title) . '</title>';
         $xml .= '<link>' . $root . JRoute::_('index.php?option=com_ninjaboard&view=topic&id=' . $item->ninjaboard_topic_id . '&post=' . $item->id . '#p' . $item->id) . '</link>';
         $xml .= '<description>' . htmlspecialchars(KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->text))) . '</description>';
         $xml .= '<guid isPermaLink="false">' . $item->uuid . '</guid>';
         $xml .= '<media:title>' . htmlspecialchars($item->title) . '</media:title> ';
         $xml .= '<media:content url="' . $root . JRoute::_('index.php?option=com_ninjaboard&view=avatar&id=' . $item->created_by . '&format=file') . '"/>';
         $xml .= '</item>';
     }
     $xml .= '</channel>';
     $xml .= '</rss>';
     $this->output = $xml;
     return parent::display();
 }
コード例 #5
0
ファイル: csv.php プロジェクト: daodaoliang/nooku-framework
 /**
  * Return the views output
  *
  * @param KViewContext  $context A view context object
  * @return string   The output of the view
  */
 protected function _actionRender(KViewContext $context)
 {
     $rows = '';
     $columns = array();
     $entities = $this->getModel()->fetch();
     // Get the columns
     foreach ($entities as $entity) {
         $data = $entity->toArray();
         $columns = array_merge($columns + array_flip(array_keys($data)));
     }
     // Empty the column values
     foreach ($columns as $key => $value) {
         $columns[$key] = '';
     }
     //Create the rows
     foreach ($entities as $entity) {
         $data = $entity->toArray();
         $data = array_merge($columns, $data);
         $rows .= $this->_arrayToString(array_values($data)) . $this->eol;
     }
     // Create the header
     $header = $this->_arrayToString(array_keys($columns)) . $this->eol;
     // Set the content
     $this->setContent($header . $rows);
     return parent::_actionRender($context);
 }
コード例 #6
0
ファイル: html.php プロジェクト: janssit/www.gincoprojects.be
 public function display($tpl = null)
 {
     $prefix = $this->getClassName('prefix');
     //Set the main stylesheet for the component
     KViewHelper::_('stylesheet', $prefix . '.css', 'media/com_' . $prefix . '/css/');
     parent::display($tpl);
 }
コード例 #7
0
ファイル: ajax.php プロジェクト: janssit/www.gincoprojects.be
 public function __construct($options = array())
 {
     $options = $this->_initialize($options);
     // add a rule to the template for KSecurityToken
     KTemplateDefault::addRules(array(KFactory::get('lib.koowa.template.rule.token')));
     // Set a base path for use by the view
     $this->assign('baseurl', $options['base_url']);
     parent::__construct($options);
 }
コード例 #8
0
ファイル: json.php プロジェクト: ravenlife/Ninja-Framework
 /**
  * Return the views output
  * 
  * If the view 'output' variable is empty the output will be generated based on
  * the model data, if it set it will be returned instead.
  *
  *  @return string 	The output of the view
  */
 public function display()
 {
     if (empty($this->output)) {
         $model = $this->getModel();
         if (KInflector::isPlural($this->getName())) {
             $data = $model->getList();
         } else {
             $data = $model->getItem();
         }
         $this->output = json_encode($data->toArray());
     }
     return parent::display();
 }
コード例 #9
0
 /**
  * Return the views output
  *
  * If the view 'output' variable is empty the output will be generated based on the
  * model data, if it set it will be returned instead.
  *
  * If the model contains a callback state, the callback value will be used to apply
  * padding to the JSON output.
  *
  *  @return string 	The output of the view
  */
 public function display()
 {
     if (empty($this->output)) {
         $this->output = KInflector::isPlural($this->getName()) ? $this->_getList() : $this->_getItem();
     }
     if (!is_string($this->output)) {
         $this->output = json_encode($this->output);
     }
     //Handle JSONP
     if (!empty($this->_padding)) {
         $this->output = $this->_padding . '(' . $this->output . ');';
     }
     return parent::display();
 }
コード例 #10
0
ファイル: feed.php プロジェクト: kedweber/com_articles
 public function display()
 {
     $articles = $this->getModel()->limit(20)->getList();
     $doc = JFactory::getDocument();
     foreach ($articles as $article) {
         $item = new JFeedItem();
         $item->title = $article->title;
         $item->link = $this->createRoute('option=com_articles&view=article&date=' . date('Y-m-d', strtotime($article->publish_up)) . '&id=' . $article->id . '&slug=' . $article->slug . '&format=html');
         $item->description = $article->introtext;
         $item->date = $article->publish_up;
         $category = json_decode($article->ancestors)->category;
         if (is_numeric($category)) {
             $item->category = $this->getService('com://site/makundi.model.categories')->id($category)->getItem()->title;
         }
         $doc->addItem($item);
     }
     return parent::display();
 }
コード例 #11
0
ファイル: feed.php プロジェクト: kedweber/com_featured
 public function display()
 {
     $items = $this->getModel()->limit(20)->getList();
     $doc = JFactory::getDocument();
     foreach ($items as $item) {
         $item = $this->getService($item->identifier)->id($item->row)->getItem();
         $option = $item->getIdentifier()->package;
         $view = KInflector::singularize($item->getIdentifier()->name);
         $feed_item = new JFeedItem();
         $feed_item->title = $item->title;
         $feed_item->link = $this->createRoute('option=com_' . $option . '&view=' . $view . '&id=' . $item->id . '&format=html');
         $feed_item->description = $item->introtext;
         $feed_item->date = $item->publish_up;
         if ($item->isRelationable() && $item->category) {
             $feed_item->category = $item->category->title;
         }
         $doc->addItem($feed_item);
     }
     return parent::display();
 }
コード例 #12
0
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   object  An optional KConfig object with configuration options
  * @return  void
  */
 protected function _initialize(KConfig $config)
 {
     $count = count($this->getIdentifier()->path);
     $config->append(array('path' => '', 'filename' => $this->getIdentifier()->path[$count - 1] . '.' . $this->getIdentifier()->name, 'disposition' => 'attachment', 'transport' => 'php'));
     parent::_initialize($config);
 }
コード例 #13
0
 /**
  * Supports a simple form of Fluent Interfaces. Allows you to assign variables to the view 
  * by using the variable name as the method name. If the method name is a setter method the 
  * setter will be called instead.
  *
  * For example : $view->layout('foo')->title('name')->display().
  *
  * @param   string  Method name
  * @param   array   Array containing all the arguments for the original call
  * @return  KViewAbstract
  *
  * @see http://martinfowler.com/bliki/FluentInterface.html
  */
 public function __call($method, $args)
 {
     //If one argument is passed we assume a setter method is being called
     if (count($args) == 1) {
         if (method_exists($this, 'set' . ucfirst($method))) {
             return $this->{'set' . ucfirst($method)}($args[0]);
         } else {
             return $this->set($method, $args[0]);
         }
     }
     return parent::__call($method, $args);
 }
コード例 #14
0
ファイル: json.php プロジェクト: daodaoliang/nooku-framework
 /**
  * Force the route to fully qualified and not escaped by default
  *
  * @param   string|array    $route   The query string used to create the route
  * @param   boolean         $fqr     If TRUE create a fully qualified route. Default TRUE.
  * @param   boolean         $escape  If TRUE escapes the route for xml compliance. Default FALSE.
  * @return  KDispatcherRouterRoute The route
  */
 public function getRoute($route = '', $fqr = true, $escape = false)
 {
     return parent::getRoute($route, $fqr, $escape);
 }
コード例 #15
0
ファイル: json.php プロジェクト: janssit/www.gincoprojects.be
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     //Set the correct mime type
     $this->_document->setMimeEncoding('application/json');
 }
コード例 #16
0
 /**
  * Creates a route based on a full or partial query string.
  *
  * This function adds the layout information to the route if a layout has been set
  *
  * @param string|array $route   The query string used to create the route
  * @param boolean $fqr          If TRUE create a fully qualified route. Default TRUE.
  * @param boolean $escape       If TRUE escapes the route for xml compliance. Default TRUE.
  * @return  KDispatcherRouterRoute The route
  */
 public function getRoute($route = '', $fqr = true, $escape = true)
 {
     if (is_string($route)) {
         parse_str(trim($route), $parts);
     } else {
         $parts = $route;
     }
     //Check to see if there is component information in the route if not add it
     if (!isset($parts['component'])) {
         $parts['component'] = $this->getIdentifier()->package;
     }
     //Add the view information to the route if it's not set
     if (!isset($parts['view'])) {
         $parts['view'] = $this->getName();
     }
     if (!isset($parts['layout']) && !empty($this->_layout)) {
         if ($parts['component'] == $this->getIdentifier()->package && $parts['view'] == $this->getName()) {
             $parts['layout'] = $this->getLayout();
         }
     }
     return parent::getRoute($parts, $fqr, $escape);
 }
コード例 #17
0
ファイル: json.php プロジェクト: raeldc/com_learn
	/**
	 * Return the views output
	 *
	 * If the view 'output' variable is empty the output will be generated based on the
	 * model data, if it set it will be returned instead.
	 *
	 * If the model contains a callback state, the callback value will be used to apply
	 * padding to the JSON output.
 	 *
	 *  @return string 	The output of the view
	 */
    public function display()
    {
        if(empty($this->output))
        {
            $model = $this->getModel();

            if(KInflector::isPlural($this->getName())) {
                $data = array_values($model->getList()->toArray());
            } else {
                $data = $model->getItem()->toArray();
            }

            $this->output = $data;
        }

        if (!is_string($this->output)) {
        	$this->output = json_encode($this->output);
        }

        //Handle JSONP
        if(!empty($this->_padding)) {
            $this->output     = $this->_padding.'('.$this->output.');';
        }

        return parent::display();
    }
コード例 #18
0
ファイル: feed.php プロジェクト: ravenlife/Ninja-Framework
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
 }