Ejemplo n.º 1
0
 public function add()
 {
     // disable menu
     YRequest::setVar('hidemainmenu', 1);
     // get application metadata
     $metadata = $this->application->getMetaData();
     // set toolbar items
     $this->joomla->set('JComponentTitle', $this->application->getToolbarTitle(JText::_('New App') . ': ' . $metadata['name']));
     JToolBarHelper::save();
     JToolBarHelper::custom('', 'back', '', 'Back', false);
     ZooHelper::toolbarHelp();
     // get params
     $this->params = $this->application->getParams();
     // set default template
     $this->params->set('template', 'default');
     // template select
     $options = array(JHTML::_('select.option', '', '- ' . JText::_('Select Template') . ' -'));
     foreach ($this->application->getTemplates() as $template) {
         $metadata = $template->getMetaData();
         $options[] = JHTML::_('select.option', $template->name, $metadata['name']);
     }
     $this->lists['select_template'] = JHTML::_('select.genericlist', $options, 'template', '', 'value', 'text', $this->params->get('template'));
     // display view
     $this->getView()->setLayout('application')->display();
 }
Ejemplo n.º 2
0
 public function edit($tpl = null)
 {
     // disable menu
     YRequest::setVar('hidemainmenu', 1);
     // get database
     $this->db = JFactory::getDBO();
     // get request vars
     $cid = YRequest::getArray('cid.0', '', 'int');
     $edit = $cid > 0;
     // get item
     if ($edit) {
         $this->submission = YTable::getInstance('submission')->get($cid);
     } else {
         $this->submission = new Submission();
         $this->submission->application_id = $this->application->id;
         $this->submission->access = 1;
     }
     // set toolbar items
     $this->joomla->set('JComponentTitle', $this->application->getToolbarTitle(JText::_('Submission') . ': ' . $this->submission->name . ' <small><small>[ ' . ($edit ? JText::_('Edit') : JText::_('New')) . ' ]</small></small>'));
     JToolBarHelper::save();
     JToolBarHelper::custom('saveandnew', 'saveandnew', 'saveandnew', 'Save & New', false);
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', $edit ? 'Close' : 'Cancel');
     ZooHelper::toolbarHelp();
     // published select
     $this->lists['select_published'] = JHTML::_('select.booleanlist', 'state', null, $this->submission->state);
     // tooltip select
     $this->lists['select_tooltip'] = JHTML::_('select.booleanlist', 'params[show_tooltip]', null, $this->submission->showTooltip());
     // type select
     $this->types = array();
     foreach ($this->application->getTypes() as $type) {
         // list types with submission layouts only
         if (count(ZooHelper::getLayouts($this->application, $type->id, 'submission')) > 0) {
             $form = $this->submission->getForm($type->id);
             $this->types[$type->id]['name'] = $type->name;
             $options = array(JHTML::_('select.option', '', '- ' . JText::_('not submittable') . ' -'));
             $this->types[$type->id]['select_layouts'] = JHTML::_('zoo.layoutList', $this->application, $type->id, 'submission', $options, 'params[form][' . $type->id . '][layout]', '', 'value', 'text', $form->get('layout'));
             $options = array(JHTML::_('select.option', '', '- ' . JText::_('uncategorized') . ' -'));
             $this->types[$type->id]['select_categories'] = JHTML::_('zoo.categorylist', $this->application, $options, 'params[form][' . $type->id . '][category]', 'size="1"', 'value', 'text', $form->get('category'));
         }
     }
     // display view
     $this->getView()->setLayout('edit')->display();
 }
Ejemplo n.º 3
0
 public function edit()
 {
     // disable menu
     YRequest::setVar('hidemainmenu', 1);
     // get request vars
     $cid = YRequest::getArray('cid.0', '', 'int');
     $edit = $cid > 0;
     // get category
     if ($edit) {
         $this->category = YTable::getInstance('category')->get($cid);
     } else {
         $this->category = new Category();
         $this->category->parent = 0;
     }
     // get category params
     $this->params = $this->category->getParams();
     // set toolbar items
     $text = $edit ? JText::_('Edit') : JText::_('New');
     $this->joomla->set('JComponentTitle', $this->application->getToolbarTitle(JText::_('Category') . ': ' . $this->category->name . ' <small><small>[ ' . $text . ' ]</small></small>'));
     JToolBarHelper::save();
     JToolBarHelper::custom('saveandnew', 'saveandnew', 'saveandnew', 'Save & New', false);
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', $edit ? 'Close' : 'Cancel');
     ZooHelper::toolbarHelp();
     // select published state
     $this->lists['select_published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $this->category->published);
     // get categories and exclude the current category
     $categories = $this->application->getCategories();
     unset($categories[$this->category->id]);
     // build category tree
     $list = CategoryHelper::buildTreeList(0, CategoryHelper::buildTree($this->application->id, $categories));
     $options = array(JHTML::_('select.option', '0', JText::_('Root')));
     foreach ($list as $item) {
         $options[] = JHTML::_('select.option', $item->id, '&nbsp;&nbsp;&nbsp;' . $item->treename);
     }
     // select parent category
     $this->lists['select_parent'] = JHTML::_('select.genericlist', $options, 'parent', 'class="inputbox" size="10"', 'value', 'text', $this->category->parent);
     // display view
     $this->getView()->setLayout('edit')->display();
 }
Ejemplo n.º 4
0
 public function assignSubmission()
 {
     // disable menu
     YRequest::setVar('hidemainmenu', 1);
     // init vars
     $type = YRequest::getString('type');
     $this->template = YRequest::getString('template');
     $this->layout = YRequest::getString('layout');
     // get type
     $this->type = $this->application->getType($type);
     // set toolbar items
     $this->joomla->set('JComponentTitle', $this->application->getToolbarTitle(JText::_('Type') . ': ' . $this->type->name . ' <small><small>[ ' . JText::_('Assign Submittable elements') . ': ' . $this->layout . ' ]</small></small>'));
     JToolBarHelper::save('savesubmission');
     JToolBarHelper::apply('applysubmission');
     JToolBarHelper::cancel('types');
     ZooHelper::toolbarHelp();
     // for template, module, plugin
     if ($this->template) {
         $this->path = $this->application->getPath() . '/templates/' . $this->template;
     }
     // get renderer
     $renderer = new ItemRenderer();
     $renderer->addPath($this->path);
     // get positions and config
     $this->config = $renderer->getConfig('item')->get($this->group . '.' . $type . '.' . $this->layout);
     $prefix = 'item.';
     if ($renderer->pathExists('item' . DIRECTORY_SEPARATOR . $type)) {
         $prefix .= $type . '.';
     }
     $this->positions = $renderer->getPositions($prefix . $this->layout);
     // display view
     $this->getView()->setLayout('assignsubmission')->display();
 }
Ejemplo n.º 5
0
 public function edit($tpl = null)
 {
     // disable menu
     YRequest::setVar('hidemainmenu', 1);
     // get database
     $this->db = JFactory::getDBO();
     // get request vars
     $cid = YRequest::getArray('cid.0', '', 'int');
     $edit = $cid > 0;
     // get item
     if ($edit) {
         $this->item = YTable::getInstance('item')->get($cid);
     } else {
         $this->item = new Item();
         $this->item->application_id = $this->application->id;
         $this->item->type = JRequest::getVar('type');
         $this->item->publish_down = $this->db->getNullDate();
     }
     // get item params
     $this->params = $this->item->getParams();
     // set toolbar items
     $this->joomla->set('JComponentTitle', $this->application->getToolbarTitle(JText::_('Item') . ': ' . $this->item->name . ' <small><small>[ ' . ($edit ? JText::_('Edit') : JText::_('New')) . ' ]</small></small>'));
     JToolBarHelper::save();
     JToolBarHelper::custom('saveandnew', 'saveandnew', 'saveandnew', 'Save & New', false);
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', $edit ? 'Close' : 'Cancel');
     ZooHelper::toolbarHelp();
     // published select
     $this->lists['select_published'] = JHTML::_('select.booleanlist', 'state', null, $this->item->state);
     // published searchable
     $this->lists['select_searchable'] = JHTML::_('select.booleanlist', 'searchable', null, $this->item->searchable);
     // categories select
     $related_categories = $this->item->getRelatedCategoryIds();
     $this->lists['select_frontpage'] = JHTML::_('select.booleanlist', 'frontpage', null, in_array(0, $related_categories));
     $this->lists['select_categories'] = JHTML::_('zoo.categorylist', $this->application, array(), 'categories[]', 'size="15" multiple="multiple"', 'value', 'text', $related_categories);
     $this->lists['select_primary_category'] = JHTML::_('zoo.categorylist', $this->application, array(JHTML::_('select.option', '', JText::_('none'))), 'params[primary_category]', '', 'value', 'text', $this->params->get('config.primary_category'));
     // most used tags
     $this->lists['most_used_tags'] = YTable::getInstance('tag')->getAll($this->application->id, null, null, 'items DESC, a.name ASC', null, self::MAX_MOST_USED_TAGS);
     // comments enabled select
     $this->lists['select_enable_comments'] = JHTML::_('select.booleanlist', 'params[enable_comments]', null, $this->params->get('config.enable_comments', 1));
     // display view
     $this->getView()->setLayout('edit')->display();
 }
Ejemplo n.º 6
0
JHTML::stylesheet('ui.css', ZOO_ADMIN_URI . 'assets/css/');
JHTMLBehavior::modal();
// init vars
$controller = YRequest::getWord('controller');
$task = YRequest::getWord('task');
$group = YRequest::getString('group');
// change application
if ($id = YRequest::getInt('changeapp')) {
    JFactory::getApplication()->setUserState('com_zooapplication', $id);
}
// load application
$application = Zoo::getApplication();
// set default controller
if (!$controller) {
    $controller = $application ? 'item' : 'new';
    YRequest::setVar('controller', $controller);
}
// set toolbar button include path
$toolbar = JToolBar::getInstance('toolbar');
$toolbar->addButtonPath(ZOO_ADMIN_PATH . '/joomla/button');
// build menu
$menu = YMenu::getInstance('nav');
// add "app" menu items
foreach (YTable::getInstance('application')->all(array('order' => 'name')) as $app) {
    $app->addMenuItems($menu);
}
// add "new" and "manager" menu item
$new = new YMenuItem('new', '<span class="icon"> </span>', 'index.php?option=com_zoo&controller=new', array('class' => 'new'));
$manager = new YMenuItem('manager', '<span class="icon"> </span>', 'index.php?option=com_zoo&controller=manager', array('class' => 'config'));
$menu->addChild($new);
$menu->addChild($manager);