/** * Execute the controller. * * @return string * * @since 1.0 */ public function execute() { $app = $this->getContainer()->get('app'); $app->getUser()->authorize('admin'); $table = new ArticlesTable($this->getContainer()->get('db')); $table->delete($app->input->getInt('id')); $app->enqueueMessage(g11n3t('The article has been deleted.'), 'success'); $this->getContainer()->get('app')->input->set('view', 'articles'); return parent::execute(); }
/** * Execute the controller. * * @return string * * @since 1.0 */ public function execute() { $app = $this->getContainer()->get('app'); $app->getUser()->authorize('admin'); $table = new ArticlesTable($this->getContainer()->get('db')); /* @type \Joomla\Github\Github $gitHub */ $table->setGitHub($this->getContainer()->get('gitHub')); $table->save($app->input->get('article', array(), 'array')); $app->enqueueMessage(g11n3t('The article has been saved.'), 'success'); return parent::execute(); }
/** * Execute the command. * * @return void * * @since 1.0 */ public function execute() { $this->getApplication()->outputTitle('Make Documentation'); $this->usePBar = $this->getApplication()->get('cli-application.progress-bar'); if ($this->getApplication()->input->get('noprogress')) { $this->usePBar = false; } $this->github = $this->getContainer()->get('gitHub'); $this->getApplication()->displayGitHubRateLimit(); /* @type \Joomla\Database\DatabaseDriver $db */ $db = $this->getContainer()->get('db'); $docuBase = JPATH_ROOT . '/Documentation'; /* @type \RecursiveDirectoryIterator $it */ $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($docuBase, \FilesystemIterator::SKIP_DOTS)); $this->out('Compiling documentation in: ' . $docuBase)->out(); $table = new ArticlesTable($db); // @todo compile the md text here. $table->setGitHub($this->github); while ($it->valid()) { if ($it->isDir()) { $it->next(); continue; } $file = new \stdClass(); $file->filename = $it->getFilename(); $path = $it->getSubPath(); $page = substr($it->getFilename(), 0, strrpos($it->getFilename(), '.')); $this->debugOut('Compiling: ' . $page); $table->reset(); $table->{$table->getKeyName()} = null; try { $table->load(array('alias' => $page, 'path' => $path)); } catch (\RuntimeException $e) { // New item } $table->is_file = '1'; $table->path = $it->getSubPath(); $table->alias = $page; $table->text_md = file_get_contents($it->key()); $table->store(); $this->out('.', false); $it->next(); } $this->out()->out('Finished =;)'); }
/** * Get an item. * * @param integer $id The item id. * * @return ArticlesTable * * @since 1.0 */ public function getItem($id) { $table = new ArticlesTable($this->db); return $table->load($id)->getIterator(); }
/** * Get an item. * * @param string $alias The item alias. * * @return ArticlesTable * * @since 1.0 */ public function getItem($alias) { $table = new ArticlesTable($this->db); return $table->load(array('alias' => $alias)); }