Ejemplo n.º 1
1
	protected function _validate($context)
	{
		$config = $this->_config;
		$row = $context->caller;

		if (is_uploaded_file($row->file) && $config->restrict && !in_array($row->extension, $config->ignored_extensions->toArray())) 
		{
			if ($row->isImage()) 
			{
				if (getimagesize($row->file) === false) {
					$context->setError(JText::_('WARNINVALIDIMG'));
					return false;
				}
			}
			else 
			{
				$mime = KFactory::get('com://admin/files.database.row.file')->setData(array('path' => $row->file))->mimetype;

				if ($config->check_mime && $mime) 
				{
					if (in_array($mime, $config->illegal_mimetypes->toArray()) || !in_array($mime, $config->allowed_mimetypes->toArray())) {
						$context->setError(JText::_('WARNINVALIDMIME'));
						return false;
					}
				}
				elseif (!$config->authorized) {
					$context->setError(JText::_('WARNNOTADMIN'));
					return false;
				}
			}
		}
	}
Ejemplo n.º 2
0
    public function getList()
    {
        if (!isset($this->_list))
        {
            $rowset = KFactory::get('com://admin/settings.database.rowset.settings');
            
            //Insert the system configuration settings
            $rowset->insert(KFactory::get('com://admin/settings.database.row.system'));
                        
            //Insert the component configuration settings
            $components = KFactory::get('com://admin/extensions.model.components')->enabled(1)->parent(0)->getList();
            
            foreach($components as $component)
            {
                $path   = JPATH_ADMINISTRATOR.'/components/'.$component->option.'/config.xml';
                $params = new JParameter( $component->params);
                    
                $config = array(
                	'name' => strtolower(substr($component->option, 4)),
                    'path' => file_exists($path) ? $path : '',
                    'id'   => $component->id,
                    'data' => $params->toArray(),
                );
                
                $row = KFactory::get('com://admin/settings.database.row.component', $config);
                
                $rowset->insert($row);
            }
             
            $this->_list = $rowset;
        }

        return $this->_list;    
    }
Ejemplo n.º 3
0
 public function display()
 {
     //Set the document link
     $this->_document->link = $this->createRoute('format=html&view=posts&blog_blog_id=' . KRequest::get('get.id', 'int'));
     //Get the list of posts
     $posts = KFactory::get($this->getModel())->getList();
     foreach ($posts as $post) {
         // strip html from feed item title
         $title = html_entity_decode($post->title);
         // url link to article
         $link = $this->createRoute('format=html&view=post&slug=' . $post->slug);
         // generate the description as a hcard
         $description = $post->text;
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $description;
         $item->date = date('r', strtotime($post->created_on));
         $item->category = '';
         // loads item info into rss array
         $doc =& JFactory::getDocument();
         $doc->addItem($item);
     }
     return $this;
 }
Ejemplo n.º 4
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     // set the document object
     //@TODO submit koowa patch for this one
     $this->_document = KFactory::get('lib.joomla.document');
     parent::__construct($config);
 }
Ejemplo n.º 5
0
 public function display($tpl = null)
 {
     global $mainframe;
     $pathway =& $mainframe->getPathway();
     $params =& $mainframe->getParams();
     $model = KFactory::get('site::com.picman.model.album');
     $album = $model->getItem();
     // set Breadcrumbs
     $pathway->addItem($album->name);
     // set Document data
     $document =& JFactory::getDocument();
     $document->setMetaData('keywords', $album->metakey);
     $document->setMetaData('description', $album->metadesc);
     $document->setTitle($album->name);
     // Load GData plugin
     $plugin =& JPluginHelper::getPlugin('system', 'gdata');
     $gdata = new JParameter($plugin->params);
     // get Simple XML feed from GData Plugin
     $album = "picman_album_" . $album->id;
     $query = "kind=photo&access=all&thumbsize=144c&imgmax=512";
     $simpleXml = plgSystemGdata::getSimpleXml($album, $query);
     $this->assignRef('album', $album);
     $this->assignRef('params', $params);
     $this->assignRef('simpleXml', $simpleXml);
     $this->assignRef('filter', $model->getFilters());
     $this->assignRef('pagination', $model->getPagination());
     // Display the layout
     parent::display($tpl);
 }
Ejemplo n.º 6
0
    public function display()
	{
		$modules = KFactory::get('com://admin/extensions.model.modules')->position('cpanel')->application('administrator')->enabled(1)->getList();
		$this->assign('modules', $modules);
        
		return parent::display();
	}
Ejemplo n.º 7
0
 /**
  * Drops all translated copies of the table, as well as all nodes
  */
 public function delete($wheres)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $nodes = KFactory::get('admin::com.nooku.table.nodes');
     $languages = $nooku->getAddedLanguages();
     foreach ($wheres as $where) {
         $table_name = KFactory::get('admin::com.nooku.table.tables')->find($where)->get('table_name');
         // Delete all items for this table from the nodes table
         $query = $this->_db->getQuery()->where('table_name', '=', $table_name);
         $nodes->delete($query);
         if ($err = $nodes->getError()) {
             //throw new KDatabaseTableException($err);
         }
         // Delete all #__isocode_table_name
         foreach ($languages as $language) {
             $query = 'DROP TABLE ' . $this->_db->quoteName('#__' . strtolower($language->iso_code) . '_' . $table_name);
             $this->_db->execute($query);
             if ($err = $this->_db->getError()) {
                 //throw new KDatabaseTableException($err);
             }
         }
     }
     // Delete the table item in nooku_tables
     return parent::delete($wheres);
 }
Ejemplo n.º 8
0
    /**
     * Return the views output
     *
     *  @return string  The output of the view
     */
    public function display()
    {
        //Set the filename
        $filename = KFactory::get('koowa:filter.filename')->sanitize($this->_properties['FN']);
        $this->filename = $filename.'.vcf';
        
        //Render the vcard  
        $data   = 'BEGIN:VCARD';
        $data   .= "\r\n";
        $data   .= 'VERSION:2.1';
        $data   .= "\r\n";

        foreach( $this->_properties as $key => $value ) 
        {
            $data   .= "$key:$value";
            $data   .= "\r\n";
        }
        
        $data   .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z';
        $data   .= "\r\n";
        $data   .= 'END:VCARD';
        $data   .= "\r\n";
        
        $this->output = $data;
        
        parent::display();
    }
Ejemplo n.º 9
0
	public function display()
	{
		$state = $this->getModel()->getState();

		$folders = KFactory::get('com://admin/files.controller.folder')
			->container($state->container)
			->tree(true)
			->browse();

		$this->assign('folders', $folders);

		$config = KFactory::get('com://admin/files.model.configs')->getItem();

		// prepare an extensions array for fancyupload
		$extensions = $config->upload_extensions;

		$this->assign('allowed_extensions', $extensions);
		$this->assign('maxsize'           , $config->upload_maxsize);
		$this->assign('path'              , $state->container->relative_path);
		$this->assign('sitebase'          , ltrim(JURI::root(true), '/'));
		$this->assign('token'             , JUtility::getToken());
		$this->assign('session'           , JFactory::getSession());

		if (!$this->editor) {
			$this->assign('editor', '');
		}

		return parent::display();
	}
Ejemplo n.º 10
0
 public function onApplicationBeforeRender(ArrayObject $args)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     // Input
     $view = KInput::get('view', array('post', 'get'), 'cmd');
     $task = KInput::get('task', array('post', 'get'), 'cmd');
     $format = KInput::get('format', array('post', 'get'), 'cmd', null, 'html');
     $component = KInput::get('option', array('post', 'get'), 'cmd');
     // onBeforeRender
     if ('html' != $format || $task == 'edit') {
         return;
     }
     $table_name = 'menu';
     $row_id = KInput::get('Itemid', array('post', 'get'), 'int');
     if ($view == 'article' && $component == 'com_content') {
         $table_name = 'content';
         $row_id = KInput::get('id', 'get', 'slug');
     }
     $query = KFactory::get('lib.joomla.database')->getQuery()->select(array('m.*', 'n.*', 'm.nooku_node_id AS id'))->from('nooku_metadata AS m')->join('LEFT', 'nooku_nodes AS n', 'n.nooku_node_id = m.nooku_node_id')->where('row_id', '=', $row_id)->where('table_name', '=', $table_name)->where('iso_code', '=', $nooku->getLanguage());
     $meta = KFactory::get('admin::com.nooku.table.metadata')->fetchRow($query);
     // get head data
     $doc = KFactory::get('lib.joomla.document');
     $head = $doc->getHeadData();
     $head['description'] = empty($meta->description) ? @$head['description'] : $meta->description;
     $head['metaTags']['standard']['keywords'] = empty($meta->keywords) ? @$head['metaTags']['standard']['keywords'] : $meta->keywords;
     $head['metaTags']['standard']['author'] = empty($meta->author) ? @$head['metaTags']['standard']['author'] : $meta->author;
     $doc->setHeadData($head);
 }
Ejemplo n.º 11
0
 /**
  * Proxy for the onGetWebServices
  * 
  * Will call describe for each xmlrpc event handler and return the results to
  * the xmlrpc server.
  * 
  * @return array An array of associative arrays defining the available methods
  */
 function onGetWebServices()
 {
     $services = array();
     //Get the event dispatcher
     $dispatcher = KFactory::get('lib.koowa.event.dispatcher');
     $path = JPATH_COMPONENT . DS . 'xmlrpc';
     $dir = new DirectoryIterator($path);
     foreach ($dir as $file) {
         //Make sure we found a valid file
         if ($file->isDot() || in_array($file->getFilename(), array('.svn', 'index.html'))) {
             continue;
         }
         $filename = basename($file->getFilename(), ".php");
         //Load the event handler
         Koowa::import('admin::com.nooku.xmlrpc.' . $filename);
         //Register the event handler
         $dispatcher->register('NookuXmlrpc' . ucfirst($filename));
     }
     $results = $dispatcher->dispatch('describe', new ArrayObject());
     foreach ($results as $result) {
         foreach ($result as $key => $value) {
             $services[$key] = $value;
         }
     }
     return $services;
 }
Ejemplo n.º 12
0
 public function fetchElement($name, $value, &$node, $control_name)
 {
     $buffer = '';
     $chain = $node->children();
     if (!defined('NINJA_CHAIN')) {
         $document = KFactory::get('lib.joomla.document');
         $document->addStyleDeclaration("\n\t\t\t\t.wrapper {\n\t\t\t\t\t-webkit-border-radius: 3px;\n\t\t\t\t\t-moz-border-radius: 3px;\n\t\t\t\t\tborder-radius: 3px;\n\t\t\t\t\tbackground-color: #EBEBEB;\n\t\t\t\t\tbackground-color: hsla(0, 0%, 94%, 0.8);\n\t\t\t\t\tborder: 1px solid #E6E6E6;\n\t\t\t\t\tborder-color: hsla(0, 0%, 90%, 0.8);\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tpadding: 6px;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t.wrapper .chain-label {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t.wrapper .chain .value, .wrapper .chain ul.group {\n\t\t\t\t\tmargin-left: auto!important;\n\t\t\t\t}\n\t\t\t");
         define('NINJA_CHAIN', 1);
     }
     //
     $buffer .= "<div class='wrapper'>";
     foreach ($chain as $item) {
         //get the type of the parameter
         $type = (string) $item['type'];
         try {
             $identifier = new KIdentifier($type);
         } catch (KException $e) {
             $identifier = 'admin::com.ninja.element.' . $type;
         }
         $chaindata = $this->_parent->get((string) $node['name']);
         if (isset($chaindata[(string) $item['name']]) && $chaindata[(string) $item['name']] !== false) {
             $value = $chaindata[(string) $item['name']];
         } else {
             $value = (string) $item['default'];
         }
         $element = KFactory::tmp($identifier, array('parent' => $this->_parent, 'node' => $item, 'value' => $value, 'field' => $this->field, 'group' => $this->_parent->getGroup(), 'name' => $name . '[' . (string) $item['name'] . ']', 'fetchTooltip' => false));
         $buffer .= '<div class="chain ' . $name . '_' . (string) $item['name'] . ' chain-' . $type . '">';
         $buffer .= '<span class="chain-label">' . JText::_($element->label) . '</span>';
         $buffer .= $element->toString();
         $buffer .= "</div>";
     }
     $buffer .= "</div>";
     return $buffer;
 }
Ejemplo n.º 13
0
	public function setLayout($layout)
    {
        $identifier = KFactory::identify('md://admin/com.learn.docs.pages.'.$layout);

        $this->_layout = $identifier;
        return $this;
    }
Ejemplo n.º 14
0
 public function display($tpl = null)
 {
     global $mainframe;
     $pathway =& $mainframe->getPathway();
     $params =& $mainframe->getParams();
     $model = KFactory::get('site::com.immotoa.model.projects');
     $project = $model->getItem();
     // Add metadata to header
     $document =& JFactory::getDocument();
     $document->setMetaData('keywords', $project->metakey);
     $document->setMetaData('description', $project->metadesc);
     // load GData plugin and get the images
     $plugin =& JPluginHelper::getPlugin('system', 'gdata');
     $images = plgSystemGdata::getAlbumFeed("immotoa_project_" . $project->id);
     // Build Google Static Map API URL
     $project->map = "http://maps.google.com/staticmap?" . "center=" . $project->coordinates . "&amp;format=jpg&amp;zoom=" . $params->get('maps_zoom') . "&amp;" . "size=" . $params->get('maps_width') . "x" . $params->get('maps_height') . "&amp;" . "maptype=roadmap&amp;markers=" . $project->coordinates . "," . $params->get('maps_color') . "&amp;" . "sensor=false&amp;key=" . $params->get('maps_key');
     // set breadcrumbs
     $pathway->addItem($project->name);
     $this->assignRef('project', $project);
     $this->assignRef('params', $params);
     $this->assignRef('images', $images);
     $this->assignRef('filter', $model->getFilters());
     $this->assignRef('pagination', $model->getPagination());
     // Display the layout
     parent::display($tpl);
 }
Ejemplo n.º 15
0
    public function categories($config = array())
    {
        $config = new KConfig($config);
        $config->append(array(
            'name'      => 'category',
            'deselect'  => true,
            'selected'  => $config->category,
            'prompt'	=> '- Select -'
        ));

        if($config->deselect) {
            $options[] = $this->option(array('text' => JText::_($config->prompt), 'value' => -1));
        }

        $options[] = $this->option(array('text' => JText::_('Uncategorised'), 'value' => 0));

        if($config->section != '0')
        {
            $list = KFactory::get('com://admin/categories.model.categories')
                ->set('section', $config->section > 0 ? $config->section : 'com_content')
                ->set('sort', 'title')
                ->set('limit', 0)
                ->getList();

            foreach($list as $item) {
                $options[] = $this->option(array('text' => $item->title, 'value' => $item->id));
            }
        }
        else $config->selected = 0;

        $config->options = $options;

        return $this->optionlist($config);
    }
Ejemplo n.º 16
0
    public function display()
    {
        $profiler = KFactory::get('com://admin/debug.profiler.events');
        $database = KFactory::get('com://admin/debug.profiler.queries');
        $language = KFactory::get('joomla:language');
        
        //Remove the template includes
        $includes = get_included_files();
        
        foreach($includes as $key => $value)
        {
            if($value == 'tmpl://koowa.template.stack') {
                unset($includes[$key]);
            }
        }
	    
	    $this->assign('memory'   , $profiler->getMemory())
	         ->assign('events'   , $profiler->getEvents())
	         ->assign('queries'  , $database->getQueries())
	         ->assign('languages', $language->getPaths())
	         ->assign('includes' , $includes)
	         ->assign('strings'  , $language->getOrphans());
                        
        return parent::display();
    }
Ejemplo n.º 17
0
 public function display($tpl = null)
 {
     $model = KFactory::get('admin::com.nooku.model.articles');
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $article = $model->getArticle();
     $id = $model->getState('id');
     if (JString::strlen($article->fulltext) > 1) {
         $text = $article->introtext . "<hr id=\"system-readmore\" />" . $article->fulltext;
     } else {
         $text = $article->introtext;
     }
     // for the lang switcher
     $languages = $nooku->getLanguages();
     $target_lang = $languages[$nooku->getLanguage()];
     $source_lang = $nooku->getPrimaryLanguage();
     $source_url = 'index.php?option=com_nooku&view=translate.source&tmpl=component&id=' . $id . '&source_lang=' . $source_lang->iso_code;
     // Assign to template
     $this->assign('text', $text);
     $this->assign('languages', $languages);
     $this->assign('target_lang', $target_lang);
     $this->assign('source_lang', $source_lang);
     $this->assign('source_url', $source_url);
     $this->assign('id', $id);
     // Display the layout
     parent::display($tpl);
 }
Ejemplo n.º 18
0
 /**
  * Decodes json data on each field
  * 
  * @return boolean	true.
  */
 protected function _afterTableSelect(KCommandContext $context)
 {
     //We should only run this on row objects
     if ($context->mode == KDatabase::FETCH_FIELD) {
         return;
     }
     $rows = $context['data'];
     $identifier = clone $rows->getTable();
     $identifier->path = array('model');
     $identifier->name = 'settings';
     $defaults = KFactory::get($identifier)->getParams()->toArray();
     if (is_a($rows, 'KDatabaseRowInterface')) {
         $rows = array($rows);
     }
     foreach ($rows as $row) {
         //if(is_array($row->params)) continue;
         //echo $row->params;
         //if(is_array($row->params)) die('<pre>'.var_export(is_string($row->params) && !is_null($row->params), true).'</pre>');
         //$true = false;
         //if(is_array($row->params)) $true = true;
         $params = is_string($row->params) ? json_decode($row->params, true) : $row->params;
         //if(!is_array($params)) $params = array();
         //if($true) die('<pre>'.__CLASS__.' '.var_export($params, true).'</pre>');
         $params = new KConfig($params);
         //@TODO Make this configurable, instead of hardcoding the defaults to only apply when JSite
         if (KFactory::get('lib.joomla.application')->isSite()) {
             $params->append($defaults);
         }
         $row->params = $params;
     }
 }
Ejemplo n.º 19
0
 public function display()
 {
     //Get User details from Joomla!
     $joomla = array('Name' => 'name', 'Username' => 'username', 'E-Mail' => 'email', 'Group' => 'usertype', 'Register Date' => 'registerDate', 'Last Visit Date' => 'lastvisitDate');
     $this->assign('joomla', $joomla);
     $this->assign('ifedit', range(0, 1));
     //Get user
     $usertype = KFactory::get('lib.joomla.user')->get('usertype');
     $this->assign('avatar', null);
     $user = KFactory::get($this->getModel())->getItem();
     $usergroups = array();
     foreach ($user->usergroups as $group) {
         $usergroups[] = $group->id;
     }
     $this->usergroups = $usergroups;
     if ($user->inherits) {
         $this->usergroups = 0;
         $inherits = array();
         foreach ($user->usergroups as $usergroup) {
             $link = '<a href="' . $this->createRoute('view=usergroup&id=' . $usergroup->id) . '">';
             $link .= $usergroup->title;
             $link .= '</a>';
             $inherits[] = $link;
         }
         $this->inherits = implode(', ', $inherits);
     }
     // Display the layout
     return parent::display();
 }
Ejemplo n.º 20
0
 /**
  * Proxy the router parse function to fix a bug in the core
  *
  * @param	object	$url	The URI to parse
  * @return	array
  */
 public function parse($uri)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $app = KFactory::get('lib.joomla.application');
     // Perform the actual parse
     $result = parent::parse($uri);
     $this->setVars($result);
     // Redirect if the language has changed
     $old = $nooku->getLanguage();
     $new = KInput::get('lang', array('post', 'get'), 'lang');
     if (isset($new) && strtolower($new) != strtolower($old)) {
         //Set the language
         $nooku->setLanguage($new);
         if (KInput::getMethod() == 'POST') {
             $uri->setVar('lang', $new);
             $route = JRoute::_($uri->toString(), false);
             /*
              * Dirty hack. Joomla URI class transforms cid[] into cid[0]
              * 
              * TODO : either fix in KUri or in the koowa javascript uri parser
              */
             $route = str_replace('cid[0]', 'cid[]', $route);
             $app->redirect($route);
         }
     }
     return $result;
 }
Ejemplo n.º 21
0
 /**
  * Command handler
  * 
  * @param string  $name		The command name
  * @param mixed   $args		The command arguments
  *
  * @return boolean
  */
 public function execute($name, $args)
 {
     $parts = explode('.', $name);
     $event = 'on' . KInflector::implode($parts);
     $dispatcher = KFactory::get('lib.koowa.event.dispatcher');
     return $dispatcher->dispatch($event, $args);
 }
Ejemplo n.º 22
0
 public function display($tpl = null)
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $dashboard = KFactory::get('admin::com.nooku.model.dashboard');
     $translations = KFactory::get('admin::com.nooku.model.translations');
     $translators = KFactory::get('admin::com.nooku.model.translators');
     // Mixin a menubar object
     $this->mixin(new NookuMixinMenu($this));
     $this->displayMenubar();
     $this->displayMenutitle();
     $this->displayToolbar();
     // Get data from the model
     // left panes
     $this->assignRef('additions', $dashboard->getAdditions());
     $this->assignRef('changes', $dashboard->getChanges());
     $this->assignRef('deletes', $dashboard->getDeletes());
     $this->assignRef('all_translators', $nooku->getTranslators());
     $this->assignRef('all_languages', $nooku->getLanguages());
     $this->assignRef('all_tables', $nooku->getTables());
     // Pie chart URI's
     $this->assign('translations', $translations->getGoogleChartUrl());
     $this->assign('translators', $translators->getGoogleChartUrl());
     // Meta
     $this->assign('multiple_langs', count($nooku->getLanguages()) > 1);
     $this->assign('multiple_contributors', $translators->countContributors() > 1);
     $this->assign('has_tables', count($nooku->getTables()) > 0);
     // Display the layout
     parent::display($tpl);
 }
Ejemplo n.º 23
0
    protected function _getList(KModelAbstract $model)
    {
    	// Save state data for later
        $state_data = $model->getState()->getData();

        $nodes = KFactory::get('com://admin/files.model.nodes')->set($state_data)->getList();

        $needed  = array();
        foreach ($nodes as $row)
        {
        	if ($row->isImage()) {
        		$needed[] = $row->name;	
        	}
        }

		$model->reset();
		$model->set('files', $needed);
		$list  = array_values($model->getList()->toArray());

    	$found = array();
        foreach ($list as $row) {
        	$found[] = $row['filename'];
        }

        if ($found !== $needed) 
        {
        	$new = array();
        	foreach ($nodes as $row) 
        	{
        		if ($row->isImage() && !in_array($row->name, $found)) 
        		{
	        		$result = $row->saveThumbnail(null);
	        		if ($result) {
	        			$new[] = $row->name;
	        		}
        		}
        	}
        	if (count($new))
        	{
				$model->reset();
				$model->set('files', $new);
				$list  = array_merge($list, array_values($model->getList()->toArray()));
        	}
        }
       
        $results = array();
        foreach ($list as $item) {
        	$key = $item['filename'];
        	$results[$key] = $item;
        }
        ksort($results);

        $output = new stdclass;
        $output->total  = count($list);
        $output->limit  = $state_data['limit'];
        $output->offset = $state_data['offset'];
        $output->items  = $results;

        return $output;
    }
Ejemplo n.º 24
0
 public function display()
 {
     $this->assign('date', KFactory::get('lib.joomla.utilities.date'));
     // Display the toolbar
     $this->_createToolbar()->reset();
     return parent::display();
 }
Ejemplo n.º 25
0
     public function order($config = array())
     {
         $config = new KConfig($config);
         $config->append(array(
             'name'          => 'order',
             'state'         => null,
             'attribs'       => array(),
             'model'         => null,
             'package'       => $this->getIdentifier()->package,
             'selected'      => 0
        ));
        
        //@TODO can be removed when name collisions fixed
        $config->name = 'order'; 

        $app        = $this->getIdentifier()->application;
        $identifier = 'com://'.$app.'/'.$config->package.'.model.'.($config->model ? $config->model : KInflector::pluralize($config->package));

        $list = KFactory::get($identifier)->limit(0)->set($config->filter)->getList();

        $options = array();
        foreach($list as $item) {
			$options[] =  $this->option(array('text' => $item->ordering, 'value' => $item->ordering - $config->ordering));
		}
		
        $list = $this->optionlist(array(
            'options'  => $options,
            'name'     => $config->name,
            'attribs'  => $config->attribs,
            'selected' => $config->selected
        )); 
        return $list;
     }
Ejemplo n.º 26
0
 /**
  * Get the identifier for the toolbar with the same name
  *
  * @return  KIdentifierInterface
  */
 public function getToolbar()
 {
     $identifier = clone $this->_identifier;
     $identifier->path = array('toolbar');
     $identifier->name = $this->getName();
     return KFactory::get($identifier);
 }
Ejemplo n.º 27
0
 /**
  * Renders the error stack and returns the results as a string
  *
  * @param string 	$name		(unused)
  * @param array 	$params		Associative array of values
  * @return string	The output of the script
  */
 public function render($name, array $params = array(), $contents = null)
 {
     // Initialize variables
     $contents = null;
     $lists = null;
     // Get the message queue
     $messages = KFactory::get('lib.joomla.application')->getMessageQueue();
     // Build the sorted message list
     if (is_array($messages) && count($messages)) {
         foreach ($messages as $msg) {
             if (isset($msg['type']) && isset($msg['message'])) {
                 $lists[$msg['type']][] = $msg['message'];
             }
         }
     }
     // If messages exist render them
     if (is_array($lists)) {
         $contents .= "\n<dl id=\"system-message\">";
         // Build the return string
         foreach ($lists as $type => $msgs) {
             if (count($msgs)) {
                 $contents .= "\n<dt class=\"" . strtolower($type) . "\">" . JText::_($type) . "</dt>";
                 $contents .= "\n<dd class=\"" . strtolower($type) . " message fade\">";
                 $contents .= "\n\t<ul>";
                 foreach ($msgs as $msg) {
                     $contents .= "\n\t\t<li>" . $msg . "</li>";
                 }
                 $contents .= "\n\t</ul>";
                 $contents .= "\n</dd>";
             }
         }
         $contents .= "\n</dl>";
     }
     return $contents;
 }
Ejemplo n.º 28
0
	public function editors($config = array())
	{
		$config = new KConfig($config);
        $config->append(array(
            'name'		=> 'editor'
        ));
       
		$editors = KFactory::get('com://admin/extensions.model.plugins')
		            ->type('editors')
		            ->enabled(1)
		            ->sort(array('ordering', 'name'))
		            ->getList();
	
		foreach($editors as $editor) {
			$options[] 	= $this->option(array('text' => JText::_($editor->title), 'value' => $editor->name));
		}

		$list = $this->optionlist(array(
			'options'   => $options,
			'name'      => $config->name,
			'selected'  => $config->selected,
			'attribs'   => $config->attribs
		));

		return $list;
	}
Ejemplo n.º 29
0
 public function display()
 {
     $model = KFactory::get($this->getModel());
     $model->task($model->getItem()->id);
     $this->assign('assignees', $model->getAssignees());
     return parent::display();
 }
Ejemplo n.º 30
0
 /**
  * Returns a row with keywords, description and author, based on the 
  * tablename and row_id from the nodes table
  * 
  * @return 	object
  */
 public function getItem()
 {
     $nooku = KFactory::get('admin::com.nooku.model.nooku');
     $table_name = KInput::get('table_name', array('get', 'post'), 'cmd');
     $row_id = KInput::get('row_id', array('get', 'post'), 'int');
     $query = $this->getDBO()->getQuery()->select(array('m.*', 'n.*'))->from('nooku_metadata AS m')->join('RIGHT', 'nooku_nodes AS n', 'n.nooku_node_id = m.nooku_node_id')->where('row_id', '=', $row_id)->where('table_name', '=', $table_name);
     $result = $this->getTable()->fetchAll($query);
     //Get the row
     $item = $result->findRow('iso_code', $nooku->getLanguage());
     //If no existing row was found populate it
     if (!$item->id) {
         $original = $result->findRow('iso_code', $nooku->getPrimaryLanguage()->iso_code);
         if ($original->id) {
             $item->description = $original->description;
             $item->keywords = $original->keywords;
             $item->author = $original->author;
         } else {
             $app = KFactory::get('lib.joomla.application');
             $item->description = $app->getCfg('MetaDesc');
             $item->keywords = $app->getCfg('MetaKeys');
             $item->author = KFactory::get('lib.joomla.user')->name;
         }
         $item->table_name = $table_name;
         $item->row_id = $row_id;
     }
     return $item;
 }