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; }
protected function _getItem(KModelAbstract $model) { $row = $model->getItem(); $output = new stdclass; $output->status = $row->getStatus() !== KDatabase::STATUS_FAILED && $row->path; if ($output->status !== false){ $output->item = $row->toArray(); } else { $output->error = $row->getStatusMessage(); } return $output; }
public function getItem() { if (!isset($this->_item)) { $this->_item = $this->getService('com://admin/docman.database.row.remote', array('data' => array('path' => $this->_state->path))); } return parent::getItem(); }
public function getImages() { //Removed by DC Oct 2010 to allow for multiple image pickers on one page //if(!isset($this->_images)) parent::getList(); return $this->_images; }
public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('name', 'cmd', null, true); }
public function getItem() { if (!$this->_item) { $this->_item = $this->getService('com://admin/docman.database.row.config'); } return parent::getItem(); }
/** * Get packages * * @return object */ public function getList() { if (!isset($this->_list)) { $this->_list = JFolder::files($this->_state->directory, '^[A-Za-z0-9]', false, false); $this->_total = count($this->_list); } return parent::getList(); }
protected function _initialize(KConfig $config) { $config->append(array( 'state' => KFactory::get('com://admin/files.model.state.node'), )); parent::_initialize($config); }
protected function _initialize(KObjectConfig $config) { $config->append(array( 'identity_key' => 'id' )); parent::_initialize($config); }
public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('chapter', 'cmd', 'C1') ->insert('page', 'cmd', 'default'); }
/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $config) { parent::__construct($config); $this->_state->insert('position', 'cmd')->insert('module', 'cmd')->insert('limit', 'int', 0); KLoader::load('lib.joomla.application.module.helper'); $this->_list =& JModuleHelper::_load(); $this->_total = count($this->_list); }
/** * Set the model state properties * * This function overloads the KDatabaseDocumentAbstract::set() function and only acts on state properties. * * @param string|array|object The name of the property, an associative array or an object * @param mixed The value of the property * @return KModelDocument */ public function set($property, $value = null) { parent::set($property, $value); // If limit has been changed, adjust offset accordingly if ($limit = $this->_state->limit) { $this->_state->offset = $limit != 0 ? floor($this->_state->offset / $limit) * $limit : 0; } return $this; }
/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $options) { parent::__construct($options); KLoader::load('lib.joomla.filesystem.file'); //$attr = array_diff_key($node->attributes(), array_fill_keys(array('name', 'type', 'default', 'get', 'label', 'description'), null) ); $this->_state->insert('client', 'boolean', 0)->insert('optgroup', 'string', true)->insert('incpath', 'boolean', 0)->insert('limit', 'int', 0); // $this->_list = array(); // $this->_total = count($this->_list); }
protected function _initialize(KConfig $config) { $config->append(array( 'storage_name' => $this->_identifier->name, 'table' => 'yaml' )); parent::_initialize($config); }
/** * Constructor * * @param KConfig $config Configuration options */ public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('id', 'int', null, true) ->insert('alias', 'cmd', null, true) ->insert('view', 'cmd'); }
protected function _actionCreate(KModelContext $context) { $context->entity->append(array( 'container' => $context->state->container, 'folder' => $context->state->folder, 'name' => $context->state->name )); return parent::_actionCreate($context); }
public function __construct(KConfig $options) { parent::__construct($options); $napi = clone $this->getIdentifier(); $napi->package = 'ninja'; $identifier = $this->getIdentifier(); $this->_state->insert('limit', 'int', 0); KFactory::tmp('admin::com.ninja.helper.installer', array('identifier' => $napi)); KFactory::tmp('admin::com.ninja.helper.installer', array('identifier' => $identifier)); }
public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('published' ,'int') ->insert('limit' , 'int') ->insert('offset' , 'int') ->insert('sort' , 'cmd', 'ordering') ->insert('direction', 'word', 'asc'); }
public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('name' , 'cmd', null, true) ->insert('limit' , 'int') ->insert('offset' , 'int') ->insert('sort' , 'cmd') ->insert('direction' , 'word', 'asc') ->insert('search' , 'string'); }
/** * The constructor. * * @param KConfig $config An optional configuration object. */ public function __construct(KConfig $config = null) { parent::__construct($config); $this->_state ->insert('term' , 'com://site/search.filter.term') ->insert('match' , 'cmd', 'all') ->insert('ordering' , 'cmd', 'newest') ->insert('areas' , 'cmd', null) ->insert('limit' , 'int', 20) ->insert('offset' , 'int'); }
/** * Constructor * * @param object An optional KConfig object with configuration options */ public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('limit' , 'int') ->insert('offset' , 'int') ->insert('sort' , 'cmd') ->insert('direction' , 'word', 'asc') ->insert('application', 'cmd', 'site') ->insert('default' , 'boolean', false, true) ->insert('name' , 'cmd', null, true); }
/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $options) { parent::__construct($options); $this->_state->insert('limit', 'int', 0); foreach (DateTimeZone::listIdentifiers() as $timezone) { if ($group != substr($timezone, 0, strpos($timezone, '/'))) { $group = substr($timezone, 0, strpos($timezone, '/')); $this->_list[] = (object) array('id' => false, 'title' => $group); } $this->_list[] = (object) array('id' => $timezone, 'title' => $timezone); } $this->_total = count($this->_list); }
public function __construct(KConfig $config) { parent::__construct($config); $this->_state ->insert('name' , 'cmd') ->insert('hash' , 'cmd') ->insert('group' , 'url') ->insert('site' , 'cmd', 'default') ->insert('limit' , 'int') ->insert('offset', 'int') ->insert('sort' , 'cmd') ->insert('direction', 'word', 'asc') ->insert('search' , 'string'); }
protected function _initialize(KConfig $config) { try { $this->oauthc = new OAuth('hzu3fy5dMCbbvyXTNitLsg', 'sFVcblXvb1MXFjup3tHG0hkWcxyGXMpaZU80SUDjE', OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI); $this->oauthc->enableDebug(); $this->oauthc->setToken('83549972-XDbZwGHEDDvdKxBd1Ij2qJtp3K0P2zAlNYym1mbA', 'pydldWuaWVMDVJvHhjiHq6q61ViZ7WSMvJRAnpQzuUs'); } catch (OAuthException $e) { echo "Exception caught!\n"; echo "Response: ". $e->lastResponse . "\n"; } parent::_initialize($config); }
/** * Constructor * * @param object An optional KConfig object with configuration options */ public function __construct(KConfig $config) { parent::__construct($config); //Get a list over the default converters shipping with Ninjaboard $exclude = array('abstract.php', 'exception.php', 'interface.php', '.DS_Store'); $converters = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/databases/converters/', '.', false, false, $exclude); foreach ($converters as $name) { $name = str_replace('.php', '', $name); //Prevent exceptions caused by files like .DS_Store try { $converter = KFactory::get('admin::com.ninjaboard.database.converters.' . $name); } catch (KFactoryException $e) { continue; } if ($converter->canConvert()) { $this->_list[$name] = $converter; } } $this->_total = count($this->_list); $this->_state->insert('import', 'cmd', 'demo')->insert('limit', 'int'); }
public function __construct(KObjectConfig $config) { parent::__construct($config); $this->getState()->insert('codon', 'string'); }
public function __construct(KConfig $config) { parent::__construct($config); $this->_state->insert('e_name', 'string', null); }
public function __construct(KObjectConfig $config) { parent::__construct($config); $this->getState()->insert('container', 'identifier', '')->insert('path', 'url', null, true); }
/** * Constructor * * @param KObjectConfig $config An optional ObjectConfig object with configuration options */ public function __construct(KObjectConfig $config) { parent::__construct($config); $this->_entity = $this->getObject('lib:model.entity.immutable'); }
/** * Get the default states */ public function getDefaultState() { $app = KFactory::get('lib.joomla.application'); // Get the namespace $ns = $app->getName() . '::' . 'com.' . $this->getClassName('prefix') . '.model.' . $this->getClassName('suffix'); $state = parent::getDefaultState(); $state['order'] = $app->getUserStateFromRequest($ns . '.filter_order', 'filter_order', '', 'cmd'); $state['direction'] = $app->getUserStateFromRequest($ns . '.filter_direction', 'filter_direction', 'ASC', 'word'); $state['filter'] = $app->getUserStateFromRequest($ns . '.filter', 'filter', '', 'string'); $state['id'] = KInput::get('id', array('post', 'get'), 'raw', 'int'); // making sure $state['filter'] = KFactory::get('lib.koowa.filter.string')->sanitize($state['filter']); return $state; }