function display($tpl = null) { $app = JFactory::getApplication(); JHTML::stylesheet(JoaktreeHelper::joaktreecss()); $this->canDo = JoaktreeHelper::getActions(); // Get data from the model $items =& $this->get('Data'); $pagination =& $this->get('Pagination'); //Filter $context = 'com_joaktree.jt_applications.list.'; $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'jte.id', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($context . 'search', 'search', '', 'string'); $search = JString::strtolower($search); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('lists', $lists); JoaktreeHelper::addSubmenu('applications'); $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
public function save($form) { $canDo = JoaktreeHelper::getActions(); $msg = JText::_('JTAPPS_MESSAGE_NOSAVE'); if ($canDo->get('core.create') || $canDo->get('core.edit')) { $ret = parent::save($form); if ($ret) { $msg = JText::_('JT_MESSAGE_SAVED'); } // Bind the rules. if (isset($form['rules'])) { $actions = array(); $tmp = array(); $tmp[0] = ''; foreach ($data['rules'] as $action => $identities) { $identities = array_diff($identities, $tmp); $actions[$action] = $identities; } $table = $this->getTable(); $rules = new JRules($actions); $table->setRules($rules); } } return $msg; }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $canDo = JoaktreeHelper::getActions(); JToolBarHelper::title(' ' . JText::_('COM_JOAKTREE_CONTROL_PANEL'), 'joaktree'); if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_joaktree', '460'); } JToolBarHelper::help('JoaktreeManuel', true, 'http://joaktree.com/index.php/en/joaktree/manual'); }
/** * Display the view */ public function display($tpl = null) { // First load the treeId! $this->lists['treeId'] = $this->get('treeId'); // Load the parameters. $this->params = JoaktreeHelper::getJTParams(true); if ($this->params->get('siteedit', 1)) { $this->canDo = JoaktreeHelper::getActions(); } else { $this->canDo = null; } // set up style sheets and javascript files JHTML::stylesheet(JoaktreeHelper::joaktreecss()); JHTML::stylesheet(JoaktreeHelper::joaktreecss($this->params->get('theme'))); $document =& JFactory::getDocument(); $document->addScript(JoaktreeHelper::joaktreejs('toggle.js')); $this->lists['lineEnd'] = $document->_getLineEnd(); // Initialiase variables. $this->form = $this->get('Form'); $this->lists['appId'] = $this->get('applicationId'); $this->lists['appName'] = $this->get('applicationName'); $relationId = $this->get('relationId'); if (isset($relationId)) { $this->relation = $this->get('relation'); $this->lists['action'] = $this->get('action'); } $this->lists['action'] = isset($this->lists['action']) ? $this->lists['action'] : 'new'; $this->picture = $this->get('picture'); $personId = $this->get('personId'); if (isset($personId)) { $this->lists['userAccess'] = $this->get('access'); $this->item = $this->get('Item'); $this->lists['indLiving'] = $this->item->living; } else { $this->lists['userAccess'] = true; $this->lists['indLiving'] = false; } $patronym = $this->params->get('patronym', 0); $this->lists['indPatronym'] = $patronym == 0 ? false : true; $familyname = $this->params->get('familyname', 0); $this->lists['indNamePreposition'] = $familyname == 1 ? true : false; $this->lists['CR'] = JoaktreeHelper::getJoaktreeCR(); if ($this->lists['userAccess']) { // set title if (isset($personId)) { $title = $this->item->firstName . ' ' . $this->item->familyName; $document->setTitle($title); } } parent::display($tpl); }
function display($tpl = null) { if ($tpl == null) { $this->lists = array(); $app = JFactory::getApplication('site'); $document =& JFactory::getDocument(); // Load the parameters. $this->params = $app->getParams(); $this->params->merge(JoaktreeHelper::getGedCom()); $this->params->merge(JoaktreeHelper::getTheme(true, true)); if ($this->params->get('siteedit', 1)) { $this->canDo = JoaktreeHelper::getActions(false); } else { $this->canDo = null; } // set up style sheets and javascript files JHTML::stylesheet(JoaktreeHelper::joaktreecss()); JHTML::stylesheet(JoaktreeHelper::joaktreecss($this->params->get('theme'))); // Initialiase variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->lists['userAccess'] = $this->get('access'); $this->lists['action'] = $this->get('action'); if ($this->lists['action'] == 'select') { $this->lists['link'] = 'index.php?option=com_joaktree' . '&view=repository' . '&tmpl=component' . '&action=' . $this->lists['action']; } else { $this->lists['link'] = 'index.php?option=com_joaktree' . '&view=repository'; } $this->lists['CR'] = JoaktreeHelper::getJoaktreeCR(); } if ($this->lists['userAccess']) { // set title, meta title if ($this->params->get('gedcomName')) { $title = $this->params->get('gedcomName'); $document->setTitle($title); $document->setMetadata('title', $title); } // set additional meta tags if ($this->params->get('menu-meta_description')) { $document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } if ($this->params->get('robots')) { $document->setMetadata('robots', $this->params->get('robots')); } } parent::display($tpl); }
function display($tpl = null) { $app = JFactory::getApplication(); JHTML::stylesheet(JoaktreeHelper::joaktreecss()); JHTML::script(JoaktreeHelper::jsfile()); $this->canDo = JoaktreeHelper::getActions(); // Get data from the model $this->items =& $this->get('Data'); $this->pagination =& $this->get('Pagination'); //Filter $context = 'com_joaktree.jt_trees.list.'; $this->filter['state'] = $app->getUserStateFromRequest($context . 'filter_state', 'filter_state', '', 'cmd'); $this->filter['apptitle'] = $app->getUserStateFromRequest($context . 'filter_apptitle', 'filter_apptitle', '', 'int'); $this->filter['gendex'] = $app->getUserStateFromRequest($context . 'filter_gendex', 'filter_gendex', '', 'int'); $this->filter['order'] = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'jte.id', 'cmd'); $this->filter['order_Dir'] = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $app->getUserStateFromRequest($context . 'search', 'search', '', 'string'); $search = JString::strtolower($search); // table ordering $this->lists['order_Dir'] = $this->filter['order_Dir']; $this->lists['order'] = $this->filter['order']; // search filter $this->lists['search'] = $search; // state filter $this->state = array('published' => 1, 'unpublished' => 1, 'archived' => 0, 'trash' => 0, 'all' => 0); // application filter $this->appTitle = JoaktreeHelper::getApplications(); // gendex filter $this->gendex = array(); $selectObj = new StdClass(); $selectObj->value = 1; $selectObj->text = JText::_('JNO'); $this->gendex[] = $selectObj; unset($selectObj); $selectObj = new StdClass(); $selectObj->value = 2; $selectObj->text = JText::_('JYES'); $this->gendex[] = $selectObj; unset($selectObj); $this->lists['jsscript'] = $this->getJTscript(); $this->lists['action'] = $this->get('action'); if ($this->lists['action'] == 'assign') { $this->lists['act_treeId'] = $this->get('treeId'); } JoaktreeHelper::addSubmenu('trees'); $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { JHTML::stylesheet(JoaktreeHelper::joaktreecss()); // Initialiase variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->geoCodeSet = $this->get('GeocodeResultSet'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->canDo = JoaktreeHelper::getActions(); $this->addToolbar(); parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { JHTML::stylesheet(JoaktreeHelper::joaktreecss()); // Initialiase variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // use cookies $params = JComponentHelper::getParams('com_joaktree'); $this->indCookie = $params->get('indCookies', true); $this->canDo = JoaktreeHelper::getActions(); $this->addToolbar(); parent::display($tpl); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $isNew = $this->item->id == 0; $canDo = JoaktreeHelper::getActions(); JToolBarHelper::title($isNew ? JText::_('JTTHEME_TITLE_NEW') : JText::_('JTTHEME_TITLE_EDIT'), 'theme'); // If not checked out, can save the item. if ($canDo->get('core.edit')) { JToolBarHelper::apply('apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('save', 'JTOOLBAR_SAVE'); } if (empty($this->item->id)) { JToolBarHelper::cancel('theme.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('theme.cancel', 'JTOOLBAR_CLOSE'); } JToolBarHelper::divider(); JToolBarHelper::help('JoaktreeManuel', true, 'http://joaktree.com/index.php/en/joaktree/manual'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $canDo = JoaktreeHelper::getActions(); JToolBarHelper::title(' ' . JText::_('JTMAPS_TITLE'), 'map'); if ($canDo->get('core.create')) { JToolBarHelper::addNew(); } if ($canDo->get('core.edit')) { JToolBarHelper::editList(); } if ($canDo->get('core.delete')) { JToolBarHelper::deleteList('JT_CONFIRMDELETE'); } JToolBarHelper::divider(); //($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true) JToolBarHelper::custom('locations', 'location', 'JT_SUBMENU_LOCATIONS', 'JT_SUBMENU_LOCATIONS', false); JToolBarHelper::divider(); JToolBarHelper::help('JoaktreeManuel', true, 'http://joaktree.com/index.php/en/joaktree/manual'); // Sidebar JHtmlSidebar::setAction('index.php?option=com_joaktree&view=jt_maps'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $canDo = JoaktreeHelper::getActions(); JToolBarHelper::title(' ' . JText::_('JTLOCATIONS_TITLE'), 'location'); if ($canDo->get('core.edit')) { JToolBarHelper::editList(); if (!empty($this->mapSettings->geocode)) { JToolBarHelper::custom('resetlocation', 'resetlocation', 'resetlocation', JText::_('JTLOCATIONS_BUTTON_RESET'), true); JToolBarHelper::divider(); JToolBarHelper::custom('geocode', 'geocode', 'geocode', JText::sprintf('JTLOCATIONS_BUTTON_GEOCODE', ucfirst($this->mapSettings->geocode)), false); } } if ($canDo->get('core.delete')) { JToolBarHelper::divider(); //$bar = JToolBar::getInstance('toolbar'); // explanation: $bar->appendButton('Standard', $icon, $alt, $task, $listSelect); //$bar->appendButton('purge', 'location', 'JTFAMTREE_TASK', 'purgeLocation', false); JToolBarHelper::custom('purgelocations', 'purgelocations', 'purgelocations', JText::_('JTLOCATIONS_BUTTON_PURGE'), false); } JToolBarHelper::divider(); JToolBarHelper::help('JoaktreeManuel', true, 'http://joaktree.com/index.php/en/joaktree/manual'); // Sidebar JHtmlSidebar::setAction('index.php?option=com_joaktree&view=jt_locations'); JHtmlSidebar::addFilter(JText::_('JT_FILTER_SERVER'), 'filter_server', JHtml::_('select.options', $this->server, 'value', 'text', $this->lists['server'], true)); JHtmlSidebar::addFilter(JText::_('JT_FILTER_STATUS_ALL'), 'filter_status', JHtml::_('select.options', $this->status, 'value', 'text', $this->lists['status'], true)); }
public function getGedcom() { $canDo = JoaktreeHelper::getActions(); $procObject = $this->getProcessObject(); if ($canDo->get('core.create') && $canDo->get('core.edit')) { if ($procObject->status == 'new') { $procObject->start = strftime('%H:%M:%S'); $procObject->msg = JText::sprintf('JTPROCESS_START_MSG', $procObject->id); } if ($procObject->status == 'end') { // store first empty object $appId = $procObject->id; $this->initObject($procObject->japp_ids); $newObject = $this->getProcessObject(); $newObject->msg = JText::sprintf('JTPROCESS_END_MSG', $appId); return json_encode($newObject); } $gedcomfile = new jt_gedcomexport2($procObject); $resObject = $gedcomfile->process(); $resObject->current = strftime('%H:%M:%S'); $this->setProcessObject($resObject); $return = json_encode($resObject); } else { $procObject->status = 'error'; $procObject->msg = JText::_('JT_NOTAUTHORISED'); $return = json_encode($procObject); } return $return; }
public function purgeLocations() { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.delete')) { $msg = ''; $update_queries = array(); $update_queries[] = 'DELETE jln.* ' . 'FROM #__joaktree_locations jln ' . 'WHERE NOT EXISTS ' . '( SELECT 1 ' . ' FROM #__joaktree_person_events jpt ' . ' WHERE jpt.loc_id = jln.id ' . ' UNION ' . ' SELECT 1 ' . ' FROM #__joaktree_relation_events jrt ' . ' WHERE jrt.loc_id = jln.id ' . ') '; $update_queries[] = 'INSERT INTO #__joaktree_locations (indexLoc , value) ' . 'SELECT SUBSTRING(TRIM(location), 1, 1) ' . ', TRIM(location) ' . 'FROM #__joaktree_person_events ' . 'WHERE loc_id IS NULL ' . 'AND location IS NOT NULL ' . 'UNION ' . 'SELECT SUBSTRING(TRIM(location), 1, 1) ' . ', TRIM(location) ' . 'FROM #__joaktree_relation_events ' . 'WHERE loc_id IS NULL ' . 'AND location IS NOT NULL '; $update_queries[] = 'UPDATE ' . ' #__joaktree_person_events jpe ' . ', #__joaktree_locations jln ' . 'SET jpe.loc_id = jln.id ' . 'WHERE TRIM(jpe.location) = TRIM(jln.value) ' . 'AND jpe.loc_id IS NULL '; $update_queries[] = 'UPDATE ' . ' #__joaktree_relation_events jre ' . ', #__joaktree_locations jln ' . 'SET jre.loc_id = jln.id ' . 'WHERE TRIM(jre.location) = TRIM(jln.value) ' . 'AND jre.loc_id IS NULL '; // Perform all queries - we don't care if it fails foreach ($update_queries as $query) { $this->_db->setQuery($query); $this->_db->query(); } $return = $msg; } else { $return = JText::_('JT_NOTAUTHORISED'); } return $return; }
public function delete($appId, $sourceId) { // Load the parameters. $params = JComponentHelper::getParams('com_joaktree'); if ($params->get('siteedit', 1)) { $canDo = JoaktreeHelper::getActions(false); } if (is_object($canDo) && $canDo->get('core.delete')) { $prefix = 'Table'; $config = array(); $table = JTable::getInstance('joaktree_repositories', $prefix, $config); $table->id = $repoId; $table->app_id = $appId; // retrieve row - for display later on if (!$table->load()) { $this->setError($this->_db->getErrorMsg()); return false; } // Delete the row from the database if (!$table->delete()) { $this->setError($this->_db->getErrorMsg()); return false; } // log $log = JTable::getInstance('joaktree_logs', $prefix, $config); $log->app_id = $appId; $log->object_id = $sourceId; $log->object = 'sour'; $log->log('D'); $logDel = JTable::getInstance('joaktree_logremovals', $prefix, $config); $logDel->app_id = $appId; $logDel->object_id = $sourceId; $logDel->object = 'sour'; $logDel->description = $table->title; if ($logDel->check()) { $logDel->store(); } //return $return = $table->title; } else { $return = false; } return $return; }
private function getHtml() { $html = array(); $canDo = JoaktreeHelper::getActions(); $html[] = '<form action="' . JRoute::_('index.php?option=com_joaktree') . '" method="post" id="adminForm" name="adminForm" >'; $saveOrderingUrl = 'index.php?option=com_joaktree&task=joaktree.saveOrderAjax&tmpl=component'; $html[] = JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', null, $saveOrderingUrl); if (!empty($this->sidebar)) { $html[] = '<div id="j-sidebar-container" class="span2">'; $html[] = $this->sidebar; $html[] = '</div>'; $divClassSpan = 'span10'; } else { $divClassSpan = ''; } $html[] = '<div id="j-main-container" class="' . $divClassSpan . '">'; $html[] = '<!-- No filter row -->'; $html[] = '<div class="clearfix"> </div>'; $html[] = '<!-- table -->'; $html[] = '<table class="table table-striped" id="articleList">'; $html[] = ' <thead>'; //$html[] = ' <tr>'; //$html[] = ' <th colspan="5"> </th>'; //$html[] = ' <th colspan="2">'.JText::_( 'JTSETTINGS_HEADING_LIVINGPERSON' ).'</th>'; //$html[] = ' <th colspan="2"> </th>'; //$html[] = ' </tr>'; $html[] = ' <tr>'; $html[] = ' <th width="1%" class="nowrap center hidden-phone">' . JText::_('JT_HEADING_NUMBER') . '</th>'; $html[] = ' <th width="1%" class="hidden-phone">'; $html[] = ' <input type="checkbox" name="checkall-toggle" value="" title="' . JText::_('JGLOBAL_CHECK_ALL') . '" onclick="Joomla.checkAll(this)" />'; $html[] = ' </th>'; $html[] = ' <th class="nowrap hidden-phone">'; $html[] = JHtml::_('image', 'admin/icon-16-notice-note.png', null, 'title="' . JText::_('JTSETTINGS_HEADING_EXPLANATION') . '"', true); $html[] = ' </th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JTSETTINGS_HEADING_FIELD') . '</th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JTSETTINGS_HEADING_ORDER') . '</th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JT_HEADING_PUBLISHED') . '</th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JTSETTINGS_HEADING_SAVE') . '</th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JT_HEADING_ACCESS') . '</th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JTSETTINGS_HEADING_ACCESS_LIVPERSON') . '</th>'; $html[] = ' <th class="nowrap hidden-phone">' . JText::_('JTSETTINGS_HEADING_ALT_LIVPERSON') . '</th>'; $html[] = ' </tr>'; $html[] = ' </thead>'; $html[] = ' <tbody>'; $html[] = ' </tbody>'; foreach ($this->items as $i => $row) { $published = JHTML::_('grid.published', $row, $i); $gedcomLabel = '<input type="hidden" id="jtid' . $row->id . '" name="jtid[' . $row->id . ']" value="' . $row->id . '" />'; $gedcomLabel .= '<input type="hidden" id="code' . $row->id . '" name="code[' . $row->id . ']" value="' . JText::_($row->code) . '" />'; $gedcomLabel .= JText::_($row->code); $access = '<select id="access' . $row->id . '" name="access' . $row->id . '" class="inputbox" onchange="javascript:changeAccessLevel(\'cb' . $i . '\')">'; $access .= JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $row->access); $access .= '</select>'; $accessLiving = '<select id="accessLiving' . $row->id . '" name="accessLiving' . $row->id . '" class="inputbox" onchange="javascript:changeAccessLevel(\'cb' . $i . '\')">'; $accessLiving .= '<option value="">' . JText::_('JTSETTINGS_LISTVALUE_NOBODY') . '</option>'; $accessLiving .= JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $row->accessLiving); $accessLiving .= '</select>'; $altLiving = '<select id="altLiving' . $row->id . '" name="altLiving' . $row->id . '" class="inputbox" onchange="javascript:changeAccessLevel(\'cb' . $i . '\')">'; $altLiving .= '<option value="">' . JText::_('JTSETTINGS_LISTVALUE_NOBODY') . '</option>'; $altLiving .= JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $row->altLiving); $altLiving .= '</select>'; $html[] = '<tr class="row' . $i % 2 . '">'; $html[] = ' <td class="nowrap center hidden-phone">' . $this->pagination->getRowOffset($i) . '</td>'; $html[] = ' <td class="center hidden-phone">' . JHTML::_('grid.id', $i, $row->id) . '</td>'; $html[] = ' <td class="hidden-phone" >'; $html[] = JHtml::_('image', 'admin/icon-16-notice-note.png', null, 'title="' . $this->showExplanation($row, $i) . '"', true); $html[] = ' </td>'; $html[] = ' <td class="nowrap hidden-phone">' . $gedcomLabel . '</td>'; $html[] = ' <td class="order nowrap center hidden-phone">'; if ($canDo->get('core.edit')) { $html[] = '<span class="sortable-handler hasTooltip" >'; $html[] = '<i class="icon-menu"></i>'; $html[] = '</span>'; $html[] = '<input type="text" name="order[]" size="5" value="' . $row->ordering . '" class="width-20 text-area-order " />'; } else { $html[] = '<span class="sortable-handler inactive" >'; $html[] = '<i class="icon-menu"></i>'; $html[] = '</span>'; } $html[] = ' </td>'; $html[] = ' <td class="center hidden-phone">' . JHTML::_('grid.published', $row, $i) . '</td>'; $html[] = ' <td class="center hidden-phone active">'; $html[] = ' <a href="javascript:jtsaveaccess(\'cb' . $i . '\')" title="' . JText::_('JTSETTINGS_TOOLTIP_SAVEACCESS') . '">'; $html[] = ' <span style="padding-left: 16px; background: url(/J30/administrator/templates/isis/images/admin/filesave.png) no-repeat;"></span>'; $html[] = ' </a>'; $html[] = ' </td>'; $html[] = ' <td class="hidden-phone">' . $access . '</td>'; $html[] = ' <td class="hidden-phone">' . $accessLiving . '</td>'; $html[] = ' <td class="hidden-phone">' . $altLiving . '</td>'; $html[] = '</tr>'; } $html[] = '</table>'; $html[] = '<input type="hidden" name="option" value="com_joaktree" />'; $html[] = '<input type="hidden" name="task" value="" />'; $html[] = '<input type="hidden" name="controller" value="jt_settings" />'; $html[] = '<input type="hidden" name="boxchecked" value="0" />'; $html[] = '<input type="hidden" name="layout" value="' . $this->layout . '" />'; $html[] = JHtml::_('form.token'); $html[] = '</div>'; $html[] = '</form>'; return implode("\n", $html); }
public function save($data) { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.create') || $canDo->get('core.edit')) { // initialize tables and records $table = $this->getTable(); $msg = ''; // Bind the form fields to the table $table->id = $data['id']; $table->app_id = $data['app_id']; $table->holds = $data['holds']; $table->root_person_id = $data['root_person_id']; $table->access = $data['access']; $table->name = $data['name']; $table->theme_id = $data['theme_id']; $table->indGendex = $data['indGendex']; $table->indPersonCount = $data['indPersonCount']; $table->indMarriageCount = $data['indMarriageCount']; $table->robots = empty($data['robots']) ? null : $data['robots']; $table->catid = $data['catid']; if (!$table->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } // Make sure the table is valid if (!$table->check()) { $this->setError($this->_db->getErrorMsg()); return false; } // Bind the rules. if (isset($data['rules'])) { $actions = array(); $tmp = array(); $tmp[0] = ''; foreach ($data['rules'] as $action => $identities) { $identities = array_diff($identities, $tmp); $actions[$action] = $identities; } $rules = new JRules($actions); $table->setRules($rules); } // Store the table to the database if (!$table->store()) { $this->setError($this->_db->getErrorMsg()); return false; } $msg .= 'Tree stored: ' . $table->name; $return = $msg; } else { $return = JText::_('JT_NOTAUTHORISED'); } return $return; }
public function save(&$form) { $canDo = JoaktreeHelper::getActions(); $ret = false; // Edit changes if (is_object($canDo)) { // in case we need to set relation indicators $this->relationIds = array(); if ($canDo->get('core.create')) { // in case of a new person the id is empty and we are filling it now if ($form['person']['status'] == 'new') { // retreive ID and double check that it is not used $continue = true; $i = 0; while ($continue) { $tmpId = JoaktreeHelper::generateJTId(); $i++; if ($this->check($tmpId, 'person')) { $form['person']['id'] = $tmpId; $continue = false; break; } if ($i > 100) { $continue = false; return JText::_('JTAPPS_MESSAGE_NOSAVE'); } } } switch ($form['type']) { case "newperson": $ret = $this->save_events($form, 'person'); break; case "addparent": case "addpartner": case "addchild": $ret = $this->add_person_relations($form); if ($ret) { $ret = $this->save_events($form, 'person'); } break; default: // continue break; } } if ($canDo->get('core.edit')) { switch ($form['type']) { case "pevents": $ret = $this->save_events($form, 'person'); break; case "revents": $ret = $this->save_events($form, 'relation'); break; case "names": $ret = $this->save_names($form, 'all'); break; case "notes": $ret = $this->save_notes($form, 'person', null); break; case "references": $ret = $this->save_references($form, 'person'); break; case "media": $ret = $this->save_media($form); break; case "medialist": $ret = $this->save_medialist($form); break; case "parents": case "partners": case "children": $ret = $this->update_person_relations($form); break; default: // continue break; } } if ($canDo->get('core.edit.state')) { // State changes switch ($form['type']) { case "state": $ret = $this->save_state($form); break; default: // continue break; } } // always save / update the person if ($ret) { $ret = $this->save_person($form); } // set relation indicators - if applicable if ($ret && count($this->relationIds) > 0) { $ret = jt_relations::setRelationIndicators($form['person']['app_id'], $this->relationIds); } } // Deal with errors $errors = $this->getErrors(); if (count($errors) > 0) { $text = implode(' ##### ', $errors); $ret = false; } else { $text = $ret ? 'JT_SAVED' : 'JT_NOTAUTHORISED'; } return JText::_($text); }
function display($tpl = null) { $this->lists = array(); $app = JFactory::getApplication('site'); $document =& JFactory::getDocument(); // Load the parameters. $params = $app->getParams(); $params->merge(JoaktreeHelper::getGedCom()); $params->merge(JoaktreeHelper::getTheme(true, true)); // set up style sheets and javascript files JHTML::stylesheet(JoaktreeHelper::joaktreecss()); JHTML::stylesheet(JoaktreeHelper::joaktreecss($params->get('theme'))); $document->addScript(JoaktreeHelper::joaktreejs('toggle.js')); // get user info $userId = $this->get('userId'); if (!$userId || $userId == 0) { $document->addScript(JoaktreeHelper::joaktreejs('jtform.js')); } // Get data from the model $this->items = $this->get('items'); $this->pagination = $this->get('pagination'); $this->lists['app_id'] = $this->get('applicationId'); $this->lists['userAccess'] = $this->get('access'); $statusObj = $this->get('returnObject'); $this->lists['source_id'] = is_object($statusObj) ? $statusObj->object_id : null; $this->lists['status'] = is_object($statusObj) ? $statusObj->status : null; if ($this->lists['status'] == 'new') { $this->newItem = $this->get('newlyAddedItem'); } $this->lists['action'] = $this->get('action'); if ($this->lists['action'] == 'select') { $this->lists['link'] = 'index.php?option=com_joaktree' . '&view=sources' . '&appId=' . $this->lists['app_id'] . '&tmpl=component' . '&action=' . $this->lists['action']; // in case of "select" - what are the details $this->lists['counter'] = $this->get('counter'); } else { $this->lists['link'] = 'index.php?option=com_joaktree' . '&view=sources' . '&appId=' . $this->lists['app_id']; } if ($params->get('siteedit', 1)) { $this->canDo = JoaktreeHelper::getActions(false); } else { $this->canDo = null; } //Filter $context = 'com_joaktree.source.list.'; $search1 = $app->getUserStateFromRequest($context . 'search1', 'search1', '', 'string'); $search1 = JString::strtolower($search1); // search filter $this->lists['search1'] = $search1; // Find the value for tech $this->lists['technology'] = $this->get('technology'); // copyright $this->lists['CR'] = JoaktreeHelper::getJoaktreeCR(); $this->lists['showchange'] = (int) $params->get('indLogging', 0); //return $retObject = new stdClass(); $retObject->object = 'sour'; $this->lists['retId'] = base64_encode(json_encode($retObject)); if ($this->lists['userAccess']) { // set title, meta title if ($params->get('gedcomName')) { $title = $params->get('gedcomName'); $document->setTitle($title); $document->setMetadata('title', $title); } // set additional meta tags if ($params->get('menu-meta_description')) { $document->setDescription($params->get('menu-meta_description')); } if ($params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $params->get('menu-meta_keywords')); } if ($params->get('robots')) { $document->setMetadata('robots', $params->get('robots')); } } parent::display($tpl); }
public function deleteGedCom() { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.delete')) { $cids = JFactory::getApplication()->input->get('cid', null, 'array'); $msg = ''; foreach ($cids as $cid_num => $app_id) { $app_id = (int) $app_id; $msg .= '+' . jt_gedcomfile2::deleteGedcomData($app_id, true); } $return = $msg; } else { $return = JText::_('JT_NOTAUTHORISED'); } return $return; }
public function setDefault($id) { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.edit.state')) { // set id to default $query = $this->_db->getQuery(true); $query->update(' #__joaktree_themes '); $query->set(' home = 1 '); $query->where(' id = ' . (int) $id . ' '); $this->_db->setQuery($query); $ret = $this->_db->query(); if ($ret) { // set other record not to default $query->clear(); $query->update(' #__joaktree_themes '); $query->set(' home = 0 '); $query->where(' id <> ' . (int) $id . ' '); $this->_db->setQuery($query); $this->_db->query(); } if ($ret) { $name = JoaktreeHelper::getThemeName($id); } if ($ret) { return JText::sprintf('JTTHEME_MESSAGE_SETDEFAULT', $name); } else { return JText::sprintf('JTTHEME_ERROR_SETDEFAULT', $id); } } else { $return = JText::_('JT_NOTAUTHORISED'); } }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { $canDo = JoaktreeHelper::getActions(); JToolBarHelper::title(' ' . JText::_('JTPERSONS_TITLE'), 'person'); if ($canDo->get('core.edit.state')) { JToolBarHelper::custom('publishAll', 'publish', 'publish', JText::_('JTPERSONS_BUTTON_PUBLISHALL'), true); JToolBarHelper::custom('unpublishAll', 'unpublish', 'unpublish', JText::_('JTPERSONS_BUTTON_UNPUBLISHALL'), true); JToolBarHelper::divider(); JToolBarHelper::custom('livingAll', 'living', 'living', JText::_('JTPERSONS_BUTTON_LIVINGALL'), true); JToolBarHelper::custom('notLivingAll', 'notliving', 'notliving', JText::_('JTPERSONS_BUTTON_NOTLIVINGALL'), true); JToolBarHelper::divider(); JToolBarHelper::custom('pageAll', 'page', 'page', JText::_('JTPERSONS_BUTTON_PAGEALL'), true); JToolBarHelper::custom('noPageAll', 'nopage', 'nopage', JText::_('JTPERSONS_BUTTON_NOPAGEALL'), true); JToolBarHelper::divider(); } if ($canDo->get('core.edit')) { JToolBarHelper::custom('mapStatAll', 'statmap', 'statmap', JText::_('JTPERSONS_BUTTON_STATMAPALL'), true); JToolBarHelper::custom('mapDynAll', 'dynmap', 'dynmap', JText::_('JTPERSONS_BUTTON_DYNMAPALL'), true); JToolBarHelper::custom('noMapAll', 'nomap', 'nomap', JText::_('JTPERSONS_BUTTON_NOMAPALL'), true); JToolBarHelper::divider(); } JToolBarHelper::help('JoaktreeManuel', true, 'http://joaktree.com/index.php/en/joaktree/manual'); // Sidebar JHtmlSidebar::setAction('index.php?option=com_joaktree&view=jt_persons'); JHtmlSidebar::addFilter(JText::_('JT_FILTER_APPLICATION'), 'filter_apptitle', JHtml::_('select.options', $this->appTitle, 'value', 'text', $this->filter['apptitle'], true)); JHtmlSidebar::addFilter(JText::_('JT_FILTER_TREE'), 'filter_tree', JHtml::_('select.options', $this->tree, 'value', 'text', $this->filter['tree'], true)); JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', $this->state), 'value', 'text', $this->filter['state'], true)); JHtmlSidebar::addFilter(JText::_('JT_FILTER_LIVING'), 'filter_living', JHtml::_('select.options', $this->living, 'value', 'text', $this->filter['living'], true)); JHtmlSidebar::addFilter(JText::_('JT_FILTER_PAGE'), 'filter_page', JHtml::_('select.options', $this->page, 'value', 'text', $this->filter['page'], true)); JHtmlSidebar::addFilter(JText::_('JT_FILTER_MAP'), 'filter_map', JHtml::_('select.options', $this->map, 'value', 'text', $this->filter['map'], true)); JHtmlSidebar::addFilter(JText::_('JT_FILTER_ROBOTS'), 'filter_robots', JHtml::_('select.options', $this->robots, 'value', 'text', $this->filter['robots'], true)); }
public function save($data) { $canDo = JoaktreeHelper::getActions(); $msg = JText::_('JTAPPS_MESSAGE_NOSAVE'); if ($canDo->get('core.create') || $canDo->get('core.edit')) { // Initialise variables; $table = $this->getTable(); $key = $table->getKeyName(); $pk = !empty($data[$key]) ? $data[$key] : (int) $this->getState($this->getName() . '.id'); $isNew = $pk > 0 ? false : true; // Allow an exception to be thrown. try { // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return $msg; } // Store the data. if (!$table->store(true)) { $this->setError($table->getError()); return $msg; } // Clean the cache. $this->cleanCache(); } catch (Exception $e) { $this->setError($e->getMessage()); return $msg; } $pkName = $table->getKeyName(); if (isset($table->{$pkName})) { $this->setState($this->getName() . '.id', $table->{$pkName}); } $this->setState($this->getName() . '.new', $isNew); return JText::_('JT_MESSAGE_SAVED'); } return $msg; }
public function delete($appId, $repoId) { // Load the parameters. $params = JComponentHelper::getParams('com_joaktree'); if ($params->get('siteedit', 1)) { $canDo = JoaktreeHelper::getActions(false); } if (is_object($canDo) && $canDo->get('core.delete')) { $prefix = 'Table'; $config = array(); $table = JTable::getInstance('joaktree_repositories', $prefix, $config); $table->id = $repoId; $table->app_id = $appId; // retrieve row - for display later on if (!$table->load()) { $this->setError('Error loading repository: ' . $table->getError()); } // Delete the row from the database if (!$table->delete()) { $this->setError('Error deleting repository: ' . $table->getError()); } // log $log = JTable::getInstance('joaktree_logs', $prefix, $config); $log->app_id = $appId; $log->object_id = $repoId; $log->object = 'repo'; $log->log('D'); $logDel = JTable::getInstance('joaktree_logremovals', $prefix, $config); $logDel->app_id = $appId; $logDel->object_id = $repoId; $logDel->object = 'repo'; $logDel->description = $table->name; if ($logDel->check()) { if (!$logDel->store()) { $this->setError('Error storing log: ' . $logDel->getError()); } } // Deal with errors $errors = $this->getErrors(); if (count($errors) > 0) { $return = JText::_(implode(' ##### ', $errors)); } else { $return = JText::sprintf('JT_DELETED', $table->name); } } else { $return = JText::_('JT_NOTAUTHORISED'); } return $return; }
public function save() { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.edit')) { $input = JFactory::getApplication()->input; $cids = $input->get('cid', null, 'array'); foreach ($cids as $cid) { $id = explode('!', $cid); $id[0] = (int) $id[0]; // This is app_id $id[1] = substr($id[1], 0, (int) JoaktreeHelper::getIdlength()); // This is person_id $robot = $input->get('robot' . $cid, null, 'int'); $map = $input->get('map' . $cid, null, 'int'); $query = $this->_db->getQuery(true); $query->update(' #__joaktree_admin_persons '); $query->set(' robots = ' . ($robot - 1) . ' '); $query->set(' map = ' . ($map - 1) . ' '); $query->where(' app_id = ' . $id[0] . ' '); $query->where(' id = ' . $this->_db->quote($id[1]) . ' '); $this->_db->setQuery($query); $this->_db->query(); } $return = JText::sprintf('JTADMIN_PERSONS_UPDATED', count($cids)); } else { $return = JText::_('JT_NOTAUTHORISED'); } return $return; }
public function save($form) { $canDo = JoaktreeHelper::getActions(); $msg = JText::_('JTAPPS_MESSAGE_NOSAVE'); if ($canDo->get('core.create') || $canDo->get('core.edit')) { if ($form['selection'] == 'tree' || $form['selection'] == 'location') { $form['app_id'] = $this->getAppId($form['tree']); $form['tree_id'] = $form['tree']; $form['subject'] = $form['familyName']; $form['relations'] = $form['descendants']; unset($form['tree']); unset($form['familyName']); unset($form['personName']); unset($form['root_person_id']); unset($form['descendants']); unset($form['person_relations']); } if ($form['selection'] == 'person') { $form['tree_id'] = $form['tree']; $form['person_id'] = $form['root_person_id']; $form['relations'] = $form['person_relations']; unset($form['tree']); unset($form['personName']); unset($form['root_person_id']); unset($form['familyName']); unset($form['descendants']); unset($form['person_relations']); } $form['excludePersonEvents'] = $this->getExcludeEvents('person', $form['events']); $form['excludeRelationEvents'] = $this->getExcludeEvents('relation', $form['events']); unset($form['events']); $ret = parent::save($form); if ($ret) { $msg = JText::_('JT_MESSAGE_SAVED'); } } return $msg; }
public function save($layout) { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.edit')) { // initialize tables and records $row =& JTable::getInstance('joaktree_display_settings', 'Table'); // get the input object $input = JFactory::getApplication()->input; $cids = $input->get('cid', null, 'array'); // We are only doing it when we have items to be updated if (count($cids) > 0 and $cids[0] > 0) { for ($i = 0, $n = count($cids); $i < $n; $i++) { // Bind the form fields to the table $row->id = intval($cids[$i]); $tmp = $input->get('access' . $row->id, null, 'string'); $tmp = (int) substr($tmp, 0, 3); $row->access = $tmp; $tmp = $input->get('accessLiving' . $row->id, null, 'string'); $tmp = (int) substr($tmp, 0, 3); $row->accessLiving = $tmp; $tmp = $input->get('altLiving' . $row->id, null, 'string'); $tmp = (int) substr($tmp, 0, 3); $row->altLiving = $tmp; //$code = $input->get( 'code'.$row->id, null, 'string' ); // Make sure the table is valid if (!$row->check()) { $this->setError($this->_db->getErrorMsg()); return false; } // Store the table to the database if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } // $retmsg .= $model->store($post, $code).'; '; } } $this->setOrder($layout); $return = ''; } else { $return = JText::_('JT_NOTAUTHORISED'); } return $return; }
public function getGedcom() { $canDo = JoaktreeHelper::getActions(); $procObject = $this->getProcessObject(); if ($canDo->get('core.create') && $canDo->get('core.edit')) { switch ($procObject->status) { case 'new': $procObject->start = strftime('%H:%M:%S'); $procObject->msg = JText::sprintf('JTPROCESS_START_MSG', $procObject->id); case 'progress': // continue // continue case 'endload': // continue // continue case 'endpat': // continue $gedcomfile = new jt_gedcomfile2($procObject); $resObject = $gedcomfile->process('all'); if ($resObject->status == 'endrel') { $msg = jt_gedcomfile2::clear_gedcom(); if ($msg) { $resObject->msg .= $msg . '<br />'; } } $resObject->current = strftime('%H:%M:%S'); $this->setProcessObject($resObject); $return = json_encode($resObject); break; case 'endrel': // Start loop throuth the assign FT $procObject->status = 'start'; // Addition for processing tree-persons // Addition for processing tree-persons case 'start': // continue // continue case 'starttree': // continue // continue case 'progtree': // continue // continue case 'endtree': // continue // continue case 'treedef_1': // continue // continue case 'treedef_2': // continue // continue case 'treedef_3': // continue // continue case 'treedef_4': // continue // continue case 'treedef_5': // continue // continue case 'treedef_6': // continue $familyTree = new jt_trees($procObject); $resObject = $familyTree->assignFamilyTree(); $resObject->current = strftime('%H:%M:%S'); $this->setProcessObject($resObject); $return = json_encode($resObject); break; case 'endtreedef': // we are done $procObject->status = 'end'; $procObject->current = strftime('%H:%M:%S'); $procObject->end = $procObject->current; $this->setLastUpdateDateTime(); $this->setInitialChar(); $this->setProcessObject($procObject); $return = json_encode($procObject); break; // End: Addition for processing tree-persons // End: Addition for processing tree-persons case 'end': // store first empty object $appId = $procObject->id; $this->initObject($procObject->japp_ids); $newObject = $this->getProcessObject(); $newObject->msg = JText::sprintf('JTPROCESS_END_MSG', $appId); $return = json_encode($newObject); break; case 'error': // continue // continue default: // continue break; } } else { $procObject->status = 'error'; $procObject->msg = JText::_('JT_NOTAUTHORISED'); $return = json_encode($procObject); } return $return; }
function display($tpl = null) { // Load the parameters. $model = $this->getModel(); $this->params = JoaktreeHelper::getJTParams(); $document =& JFactory::getDocument(); if ($this->params->get('siteedit', 1)) { $canDo = JoaktreeHelper::getActions(); } else { $canDo = null; } // Find the value for tech $technology = $this->get('technology'); // set up style sheets and javascript files JHTML::stylesheet(JoaktreeHelper::joaktreecss()); JHTML::stylesheet(JoaktreeHelper::joaktreecss($this->params->get('theme'))); // Set up shadowbox JHTML::stylesheet(JoaktreeHelper::shadowboxcss()); $document->addScript(JoaktreeHelper::shadowboxjs()); // Set up modal behavior JHtml::_('behavior.modal', 'a.modal'); if ($technology != 'b') { // javascript template - no ajax // default template includes ajax JHTML::stylesheet(JoaktreeHelper::briaskcss()); $document->addScript(JoaktreeHelper::joaktreejs('mod_briaskISS.js')); $document->addScript(JoaktreeHelper::joaktreejs('toggle.js')); } if ($technology != 'b' and $technology != 'j') { // default template includes ajax $document->addScript(JoaktreeHelper::joaktreejs('jtajax.js')); } // Access $lists['userAccess'] = $this->get('access'); $lists['technology'] = $technology; $edit = $this->get('action'); $lists['edit'] = $edit == 'edit' ? true : false; // Person $this->person = $this->get('person'); $model->setCookie(); $Html['lineage'] = $this->showLineage(); $lists['showAncestors'] = (int) $this->params->get('ancestorchart', 0); $lists['showDescendants'] = (int) $this->params->get('descendantchart', 0); $lists['numberArticles'] = $this->person->getArticleCount(); // Pictures $Html['pictures'] = $this->showPictures(); $lists['nextDelay'] = round((int) $this->params->get('nextDelay', 0) / 1000, 3); $lists['transDelay'] = round((int) $this->params->get('transDelay', 0) / 1000, 3); // Static map if ($this->person->map == 1) { $Html['staticmap'] = $this->person->getStaticMap(); $lists['indStaticMap'] = $Html['staticmap'] ? true : false; } // Interactive map if ($this->person->map == 2) { $Html['interactivemap'] = $this->person->getInteractiveMap(); $lists['indInteractiveMap'] = $Html['interactivemap'] ? true : false; $lists['pxHeightMap'] = (int) $this->params->get('pxHeight', 0); } // last update $lists['showUpdate '] = $this->params->get('show_update'); if ($lists['showUpdate '] != 'N') { $lists['lastUpdate'] = JoaktreeHelper::lastUpdateDateTimePerson($this->person->lastUpdateDate); $lists['showchange'] = (int) $this->params->get('indLogging', 0); } // copyright $lists['CR'] = JoaktreeHelper::getJoaktreeCR(); //return $retObject = new stdClass(); $retObject->object = 'prsn'; $retObject->app_id = $this->person->app_id; $retObject->object_id = $this->person->id; $lists['retId'] = base64_encode(json_encode($retObject)); // tab behavior if ((int) $this->params->get('indTabBehavior') == 1) { $lists['action'] = 'onClick'; } else { $lists['action'] = 'onMouseOver'; } $this->assignRef('Html', $Html); $this->assignRef('canDo', $canDo); $this->assignRef('lists', $lists); if ($lists['userAccess']) { // set title, meta title $title = $this->person->firstName . ' ' . $this->person->familyName; $document->setTitle($title); $document->setMetadata('title', $title); // set additional meta tags if ($this->params->get('menu-meta_description')) { $document->setDescription($this->params->get('menu-meta_description')); } if ($this->params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); } // robots if ($this->person->robots > 0) { $document->setMetadata('robots', JoaktreeHelper::stringRobots($this->person->robots)); } else { if ($this->params->get('robots')) { $document->setMetadata('robots', $this->params->get('robots')); } } } parent::display($tpl); }
public function getAssignFamilyTree() { $canDo = JoaktreeHelper::getActions(); $tmp = JFactory::getApplication()->input->get('init', null, 'int'); $procObject = (int) $tmp == 1 ? $this->initProcessObject() : $this->getProcessObject(); if ($canDo->get('core.create') && $canDo->get('core.edit')) { switch ($procObject->status) { case 'start': // continue // continue case 'starttree': // continue // continue case 'progtree': // continue // continue case 'endtree': // continue // continue case 'treedef_1': // continue // continue case 'treedef_2': // continue // continue case 'treedef_3': // continue // continue case 'treedef_4': // continue // continue case 'treedef_5': // continue // continue case 'treedef_6': // continue $familyTree = new jt_trees($procObject); $resObject = $familyTree->assignFamilyTree(); $resObject->current = strftime('%H:%M:%S'); $this->setProcessObject($resObject); $return = json_encode($resObject); break; case 'endtreedef': // we are done with this app $resObject = $this->initProcessObject($procObject->japp_ids); $resObject->current = strftime('%H:%M:%S'); $resObject->msg = JText::sprintf('JTPROCESS_END_MSG', $procObject->id); $return = json_encode($resObject); break; // End: Addition for processing tree-persons // End: Addition for processing tree-persons case 'end': case 'error': // continue // continue default: // continue $procObject->status = 'error'; $return = json_encode($procObject); break; } } else { $procObject->status = 'error'; $procObject->msg = JText::_('JT_NOTAUTHORISED'); $return = json_encode($procObject); } return $return; }
public function save($form) { $canDo = JoaktreeHelper::getActions(); if ($canDo->get('core.create') || $canDo->get('core.edit')) { if (!isset($form['name'])) { $form['name'] = isset($form['newname']) ? $form['newname'] : null; } if (isset($form['source'])) { return $this->saveSource($form); } else { if (isset($form['theme'])) { $this->createSource($form); } return parent::save($form); } } }