/** * display task * * @return void */ function display($cachable = false, $urlparams = false) { // set default view if not set $view = $this->input->getCmd('view', 'Componentbuilder'); $data = $this->getViewRelation($view); $layout = $this->input->get('layout', null, 'WORD'); $id = $this->input->getInt('id'); // Check for edit form. if (ComponentbuilderHelper::checkArray($data)) { if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_componentbuilder.edit.' . $data['view'], $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); // check if item was opend from other then its own list view $ref = $this->input->getCmd('ref', 0); $refid = $this->input->getInt('refid', 0); // set redirect if ($refid > 0 && ComponentbuilderHelper::checkString($ref)) { // redirect to item of ref $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=' . (string) $ref . '&layout=edit&id=' . (int) $refid, false)); } elseif (ComponentbuilderHelper::checkString($ref)) { // redirect to ref $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=' . (string) $ref, false)); } else { // normal redirect back to the list view $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=' . $data['views'], false)); } return false; } } return parent::display($cachable, $urlparams); }
public function exportData() { // Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // check if export is allowed for this user. $user = JFactory::getUser(); if ($user->authorise('component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder')) { // Get the input $input = JFactory::getApplication()->input; $pks = $input->post->get('cid', array(), 'array'); // Sanitize the input JArrayHelper::toInteger($pks); // Get the model $model = $this->getModel('Components'); // get the data to export $data = $model->getExportData($pks); if (ComponentbuilderHelper::checkArray($data)) { // now set the data to the spreadsheet $date = JFactory::getDate(); ComponentbuilderHelper::xls($data, 'Components_' . $date->format('jS_F_Y'), 'Components exported (' . $date->format('jS F, Y') . ')', 'components'); } } // Redirect to the list screen with error. $message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error'); return; }
public function setForm() { if (ComponentbuilderHelper::checkArray($this->Components)) { jimport('joomla.form.form'); $radio1 = JFormHelper::loadFieldType('radio', true); // start building add to sales folder xml field $xml = '<field label="Add to Backup Folder & Sales Server <small>(if set)</small>" description="" name="backup" type="radio" class="btn-group btn-group-yesno" default="0">'; $xml .= '<option value="1">Yes</option> <option value="0">No</option>'; $xml .= "</field>"; // prepare the xml $sales = new SimpleXMLElement($xml); // set components to form $radio1->setup($sales, 0); $radio2 = JFormHelper::loadFieldType('radio', true); // start building add to git folder xml field $xml = '<field label="Add to Git Folder" description="" name="git" type="radio" class="btn-group btn-group-yesno" default="1">'; $xml .= '<option value="1">Yes</option> <option value="0">No</option>'; $xml .= "</field>"; // prepare the xml $git = new SimpleXMLElement($xml); // set components to form $radio2->setup($git, 1); $list = JFormHelper::loadFieldType('list', true); // start building componet xml field $xml = '<field label="Components" description="" name="component" type="list" class="btn-group" required="true">'; $xml .= '<option value="">- Select Component -</option>'; foreach ($this->Components as $componet) { $xml .= '<option value="' . $componet->id . '">' . $this->escape($componet->name) . '</option>'; } $xml .= "</field>"; // prepare the xml $componets = new SimpleXMLElement($xml); // set components to form $list->setup($componets, 0); return array($radio1, $radio2, $list); } return false; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the xml string to JSON string. if (isset($data['xml'])) { $data['xml'] = (string) json_encode($data['xml']); } // Set the css_view string to base64 string. if (isset($data['css_view'])) { $data['css_view'] = base64_encode($data['css_view']); } // Set the css_views string to base64 string. if (isset($data['css_views'])) { $data['css_views'] = base64_encode($data['css_views']); } // Set the javascript_view_footer string to base64 string. if (isset($data['javascript_view_footer'])) { $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } // Set the javascript_views_footer string to base64 string. if (isset($data['javascript_views_footer'])) { $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * set the Joomla Version Data * * * @return oject The version data * */ private function setJoomlaVersionData() { // set the version data $versionData = json_decode(file_get_contents($this->templatePath . '/settings.json')); // add custom folders if (isset($this->componentData->folders) && ComponentbuilderHelper::checkArray($this->componentData->folders) || $this->addEximport || $this->uikit || $this->footable) { if ($this->addEximport) { // move the import view folder in place $importView = array('folder' => 'importViews', 'path' => 'admin/views/import', 'rename' => 1); $this->componentData->folders[] = $importView; // move the PHPExel Folder $PHPExcel = array('folder' => 'PHPExcel', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->folders[] = $PHPExcel; } if ($this->uikit) { // move the UIKIT Folder into place $uikit = array('folder' => 'uikit', 'path' => 'media', 'rename' => 0); $this->componentData->folders[] = $uikit; } if ($this->footable && (!isset($this->footableVersion) || 2 == $this->footableVersion)) { // move the footable folder into place $footable = array('folder' => 'footable2', 'path' => 'media/footable', 'rename' => 1); $this->componentData->folders[] = $footable; } elseif ($this->footable && 3 == $this->footableVersion) { // move the footable folder into place $footable = array('folder' => 'footable3', 'path' => 'media/footable', 'rename' => 1); $this->componentData->folders[] = $footable; } // pointer tracker $pointer_tracker = 'h'; foreach ($this->componentData->folders as $custom) { // fix path $custom['path'] = rtrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/'); // make sure we use the correct name $pathArray = (array) explode('/', $custom['path']); $firstFolder = array_values($pathArray)[0]; $lastFolder = end($pathArray); // only rename folder if last has folder name if ($custom['rename'] == 1) { $custom['path'] = str_replace('/' . $lastFolder, '', $custom['path']); $rename = 'new'; $newname = $lastFolder; if (($tkey = array_search($lastFolder, $pathArray)) !== false) { unset($pathArray[$tkey]); } } else { $lastFolder = $custom['folder']; $rename = false; $newname = ''; } // check if we sould add it to the media xml list if (!isset($this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'])) { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] = ''; } if (count($pathArray) == 1 && $firstFolder == 'media') { $this->fileContentStatic['###EXSTRA_MEDIA_FOLDERS###'] .= "\n\t\t<folder>" . $lastFolder . "</folder>"; } // check if we sould add it to the site xml list if (!isset($this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'])) { $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] = ''; } if (count($pathArray) == 1 && $firstFolder == 'site') { $this->fileContentStatic['###EXSTRA_SITE_FOLDERS###'] .= "\n\t\t<folder>" . $lastFolder . "</folder>"; } // check if we sould add it to the admin xml list if (!isset($this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'])) { $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] = ''; } if (count($pathArray) == 1 && $firstFolder == 'admin') { $this->fileContentStatic['###EXSTRA_ADMIN_FOLDERS###'] .= "\n\t\t\t<folder>" . $lastFolder . "</folder>"; } // make we have not duplicates $key_pointer = ComponentbuilderHelper::safeString($custom['folder']) . '_f' . $pointer_tracker; $pointer_tracker++; // set new folder to object $versionData->move->static->{$key_pointer} = new stdClass(); $versionData->move->static->{$key_pointer}->naam = $custom['folder']; $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = $rename; $versionData->move->static->{$key_pointer}->newName = $newname; $versionData->move->static->{$key_pointer}->type = 'folder'; $versionData->move->static->{$key_pointer}->custom = true; } unset($this->componentData->folders); unset($custom); } // add custom files if (isset($this->componentData->files) && ComponentbuilderHelper::checkArray($this->componentData->files) || $this->addEximport || $this->googlechart) { if ($this->addEximport) { // move the PHPExel main file $PHPExcel = array('file' => 'PHPExcel.php', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->files[] = $PHPExcel; } if ($this->googlechart) { // move the google chart files $googleChart = array('file' => 'google.jsapi.js', 'path' => 'media/js', 'rename' => 0); $this->componentData->files[] = $googleChart; $googleChart = array('file' => 'chartbuilder.php', 'path' => 'admin/helpers', 'rename' => 0); $this->componentData->files[] = $googleChart; } // pointer tracker $pointer_tracker = 'h'; foreach ($this->componentData->files as $custom) { // make we have not duplicates $key_pointer = ComponentbuilderHelper::safeString($custom['file']) . '_g' . $pointer_tracker; $pointer_tracker++; // set new file to object $versionData->move->static->{$key_pointer} = new stdClass(); $versionData->move->static->{$key_pointer}->naam = $custom['file']; // get the path info $pathInfo = pathinfo($custom['path']); if (isset($pathInfo['extension']) && $pathInfo['extension']) { $pathInfo['dirname'] = rtrim($pathInfo['dirname'], '/'); $pathInfo['dirname'] = ltrim($pathInfo['dirname'], '/'); $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $pathInfo['dirname']; $versionData->move->static->{$key_pointer}->rename = 'new'; $versionData->move->static->{$key_pointer}->newName = $pathInfo['basename']; // set the name $name = $pathInfo['basename']; } else { $custom['path'] = rtrim($custom['path'], '/'); $custom['path'] = ltrim($custom['path'], '/'); $versionData->move->static->{$key_pointer}->path = 'c0mp0n3nt/' . $custom['path']; $versionData->move->static->{$key_pointer}->rename = false; // set the name $name = $custom['file']; } // check if file should be updated if (isset($custom['notnew']) && $custom['notnew'] == 0) { $this->notNew[] = $key_pointer; } $versionData->move->static->{$key_pointer}->type = 'file'; $versionData->move->static->{$key_pointer}->custom = true; } unset($this->componentData->files); unset($custom); } return $versionData; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the php_helper_site string to base64 string. if (isset($data['php_helper_site'])) { $data['php_helper_site'] = base64_encode($data['php_helper_site']); } // Set the php_helper_admin string to base64 string. if (isset($data['php_helper_admin'])) { $data['php_helper_admin'] = base64_encode($data['php_helper_admin']); } // Set the sql string to base64 string. if (isset($data['sql'])) { $data['sql'] = base64_encode($data['sql']); } // Set the php_admin_event string to base64 string. if (isset($data['php_admin_event'])) { $data['php_admin_event'] = base64_encode($data['php_admin_event']); } // Set the php_site_event string to base64 string. if (isset($data['php_site_event'])) { $data['php_site_event'] = base64_encode($data['php_site_event']); } // Set the php_dashboard_methods string to base64 string. if (isset($data['php_dashboard_methods'])) { $data['php_dashboard_methods'] = base64_encode($data['php_dashboard_methods']); } // Set the css string to base64 string. if (isset($data['css'])) { $data['css'] = base64_encode($data['css']); } // Set the php_preflight_install string to base64 string. if (isset($data['php_preflight_install'])) { $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); } // Set the php_preflight_update string to base64 string. if (isset($data['php_preflight_update'])) { $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); } // Set the php_postflight_install string to base64 string. if (isset($data['php_postflight_install'])) { $data['php_postflight_install'] = base64_encode($data['php_postflight_install']); } // Set the php_postflight_update string to base64 string. if (isset($data['php_postflight_update'])) { $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); } // Set the php_method_uninstall string to base64 string. if (isset($data['php_method_uninstall'])) { $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); } // Set the readme string to base64 string. if (isset($data['readme'])) { $data['readme'] = base64_encode($data['readme']); } // Get the basic encription key. $basickey = ComponentbuilderHelper::getCryptKey('basic'); // Get the encription object $basic = new FOFEncryptAes($basickey, 128); // Encript data update_server_ftp. if (isset($data['update_server_ftp']) && $basickey) { $data['update_server_ftp'] = $basic->encryptString($data['update_server_ftp']); } // Encript data whmcs_key. if (isset($data['whmcs_key']) && $basickey) { $data['whmcs_key'] = $basic->encryptString($data['whmcs_key']); } // Encript data sales_server_ftp. if (isset($data['sales_server_ftp']) && $basickey) { $data['sales_server_ftp'] = $basic->encryptString($data['sales_server_ftp']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Build the content for the structure * * * @return boolean on success * */ protected function buildFileContent() { if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views)) { // ###COMPONENT### $this->fileContentStatic['###COMPONENT###'] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U'); // ###Component### $this->fileContentStatic['###Component###'] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'F'); // ###component### $this->fileContentStatic['###component###'] = ComponentbuilderHelper::safeString($this->componentData->name_code); // ###COMPANYNAME### $this->fileContentStatic['###COMPANYNAME###'] = trim(JFilterOutput::cleanText($this->componentData->companyname)); // ###CREATIONDATE### $this->fileContentStatic['###CREATIONDATE###'] = JFactory::getDate($this->componentData->created)->format('jS F, Y'); // ###BUILDDATE### $this->fileContentStatic['###BUILDDATE###'] = JFactory::getDate()->format('jS F, Y'); // ###AUTHOR### $this->fileContentStatic['###AUTHOR###'] = trim(JFilterOutput::cleanText($this->componentData->author)); // ###AUTHOREMAIL### $this->fileContentStatic['###AUTHOREMAIL###'] = trim($this->componentData->email); // ###AUTHORWEBSITE### $this->fileContentStatic['###AUTHORWEBSITE###'] = trim($this->componentData->website); // ###COPYRIGHT### $this->fileContentStatic['###COPYRIGHT###'] = trim($this->componentData->copyright); // ###LICENSE### $this->fileContentStatic['###LICENSE###'] = trim($this->componentData->license); // ###VERSION### $this->fileContentStatic['###VERSION###'] = trim($this->componentData->component_version); // ###Component_name### $this->fileContentStatic['###Component_name###'] = JFilterOutput::cleanText($this->componentData->name); // ###SHORT_DISCRIPTION### $this->fileContentStatic['###SHORT_DESCRIPTION###'] = trim(JFilterOutput::cleanText($this->componentData->short_description)); // ###DESCRIPTION### $this->fileContentStatic['###DESCRIPTION###'] = trim($this->componentData->description); // ###COMP_IMAGE_TYPE### $this->fileContentStatic['###COMP_IMAGE_TYPE###'] = $this->setComponentImageType($this->componentData->image); // ###ACCESS_SECTIONS### $this->fileContentStatic['###ACCESS_SECTIONS###'] = $this->setAccessSections(); // set component place holders $this->placeholders = array('###Component###' => $this->fileContentStatic['###Component###'], '###component###' => $this->fileContentStatic['###component###'], '###COMPONENT###' => $this->fileContentStatic['###COMPONENT###'], '[[[Component]]]' => $this->fileContentStatic['###Component###'], '[[[component]]]' => $this->fileContentStatic['###component###'], '[[[COMPONENT]]]' => $this->fileContentStatic['###COMPONENT###']); // ###CONFIG_FIELDSETS### $keepLang = $this->lang; $this->lang = 'admin'; // run the field sets for first time $this->setConfigFieldsets(1); $this->lang = $keepLang; // ###ADMINCSS### $this->fileContentStatic['###ADMINCSS###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['component_css']); // ###SITECSS### $this->fileContentStatic['###SITECSS###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['component_css']); // ###CUSTOM_HELPER_SCRIPT### $this->fileContentStatic['###CUSTOM_HELPER_SCRIPT###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['component_php_helper_admin']); // ###ADMIN_GLOBAL_EVENT_HELPER### $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] = ''; // ###ADMIN_GLOBAL_EVENT### $this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] = ''; // set incase no extra admin files are loaded $this->fileContentStatic['###EXSTRA_ADMIN_FILES###'] = ''; // now load the data for the global event if needed if ($this->componentData->add_admin_event == 1) { // ###ADMIN_GLOBAL_EVENT### $this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] = "\n\n" . '// Triger the Global Admin Event'; $this->fileContentStatic['###ADMIN_GLOBAL_EVENT###'] .= "\n" . $this->fileContentStatic['###Component###'] . 'Helper::globalEvent($document);'; // ###ADMIN_GLOBAL_EVENT_HELPER### $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] = "\n\n\t" . '/**'; $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '* The Global Admin Event Method.'; $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '**/'; $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t" . 'public static function globalEvent($document)'; $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '{'; $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['component_php_admin_event']); $this->fileContentStatic['###ADMIN_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '}'; } // now load the readme file if needed if ($this->componentData->addreadme == 1) { $this->fileContentStatic['###EXSTRA_ADMIN_FILES###'] .= "\n\t\t\t<filename>README.txt</filename>"; } // ###HELPER_CREATEUSER### $this->fileContentStatic['###HELPER_CREATEUSER###'] = $this->setCreateUserHelperMethod($this->componentData->creatuserhelper); // ###HELP### $this->fileContentStatic['###HELP###'] = $this->noHelp(); // ###HELP_SITE### $this->fileContentStatic['###HELP_SITE###'] = $this->noHelp(); // ###UPDATE_VERSION_MYSQL### $this->setVersionController(); // build route parse switch $this->fileContentStatic['###ROUTER_PARSE_SWITCH###'] = ''; // build route views $this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] = ''; // add the helper emailer if set $this->fileContentStatic['###HELPER_EMAIL###'] = $this->addEmailHelper(); // reset view array $viewarray = array(); $site_edit_view_array = array(); // start dynamic build foreach ($this->componentData->admin_views as $view) { $this->target = 'admin'; $this->lang = 'admin'; // set main keys $viewName_single = ComponentbuilderHelper::safeString($view['settings']->name_single); $viewName_list = ComponentbuilderHelper::safeString($view['settings']->name_list); // set site edit view array if ($view['edit_create_site_view']) { $site_edit_view_array[] = "\t\t\t\t'" . $viewName_single . "'"; $this->lang = 'both'; } // check if help is being loaded $this->checkHelp($viewName_single); // set custom admin view list links $this->setCustomAdminViewListLink($view, $viewName_list); // set view array $viewarray[] = "\t\t\t\t'" . $viewName_single . "' => '" . $viewName_list . "'"; // set the view names if ($view['settings']->name_single != 'null') { // ###VIEW### <<<DYNAMIC>>> $viewName_u = ComponentbuilderHelper::safeString($view['settings']->name_single, 'U'); $this->fileContentDynamic[$viewName_single]['###VIEW###'] = $viewName_u; $this->fileContentDynamic[$viewName_list]['###VIEW###'] = $viewName_u; // ###View### <<<DYNAMIC>>> $viewName_f = ComponentbuilderHelper::safeString($view['settings']->name_single, 'F'); $this->fileContentDynamic[$viewName_single]['###View###'] = $viewName_f; $this->fileContentDynamic[$viewName_list]['###View###'] = $viewName_f; // ###view### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###view###'] = $viewName_single; $this->fileContentDynamic[$viewName_list]['###view###'] = $viewName_single; // set some place holder for the views $this->placeholders['###view###'] = $viewName_single; $this->placeholders['###VIEW###'] = $viewName_u; $this->placeholders['###View###'] = $viewName_f; // set license per view if needed $this->setLockLicensePer($viewName_single); $this->setLockLicensePer($viewName_list); // ###FIELDSETS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###FIELDSETS###'] = $this->setFieldSet($view, $this->fileContentStatic['###component###']); // ###ACCESSCONTROL### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###ACCESSCONTROL###'] = $this->setFieldSetAccessControl($viewName_single); // ###LINKEDVIEWITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWITEMS###'] = ''; // ###ADDTOOLBAR### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###ADDTOOLBAR###'] = $this->setAddToolBar($view); // set the script for this view $this->buildTheViewScript($view); // ###VIEW_SCRIPT### $this->fileContentDynamic[$viewName_single]['###VIEW_SCRIPT###'] = $this->setViewScript($viewName_single); // ###EDITBODYSCRIPT### $this->fileContentDynamic[$viewName_single]['###EDITBODYSCRIPT###'] = $this->setEditBodyScript($viewName_single); // ###AJAXTOKE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###AJAXTOKE###'] = $this->setAjaxToke($viewName_single); if (isset($this->customScriptBuilder['php_document'][$viewName_single]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['php_document'][$viewName_single])) { // ###DOCUMENT_CUSTOM_PHP### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###'] = "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['php_document'][$viewName_single]); // clear some memory unset($this->customScriptBuilder['php_document'][$viewName_single]); } else { $this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###'] = ''; } // ###LINKEDVIEWTABLESCRIPTS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWTABLESCRIPTS###'] = ''; // ###VALIDATEFIX### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###VALIDATIONFIX###'] = $this->setValidationFix($viewName_single, $this->fileContentStatic['###Component###']); // ###EDITBODY### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###EDITBODY###'] = $this->setEditBody($view); // ###EDITBODY### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###EDITBODYFADEIN###'] = $this->setFadeInEfect($view); // ###JTABLECONSTRUCTOR### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JTABLECONSTRUCTOR###'] = $this->setJtableConstructor($viewName_single); // ###JTABLEALIASCATEGORY### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JTABLEALIASCATEGORY###'] = $this->setJtableAliasCategory($viewName_single); // ###METHOD_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###METHOD_GET_ITEM###'] = $this->setMethodGetItem($viewName_single); // ###LINKEDVIEWGLOBAL### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWGLOBAL###'] = ''; // ###LINKEDVIEWMETHODS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###LINKEDVIEWMETHODS###'] = ''; // ###JMODELADMIN_BEFORE_DELETE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_BEFORE_DELETE###'] = $this->getCustomScriptBuilder('php_before_delete', $viewName_single, "\n"); // ###JMODELADMIN_AFTER_DELETE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_AFTER_DELETE###'] = $this->getCustomScriptBuilder('php_after_delete', $viewName_single, "\n\n"); // ###JMODELADMIN_BEFORE_DELETE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_BEFORE_PUBLISH###'] = $this->getCustomScriptBuilder('php_before_publish', $viewName_single, "\n"); // ###JMODELADMIN_AFTER_DELETE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_AFTER_PUBLISH###'] = $this->getCustomScriptBuilder('php_after_publish', $viewName_single, "\n\n"); // ###CHECKBOX_SAVE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###CHECKBOX_SAVE###'] = $this->setCheckboxSave($viewName_single); // ###METHOD_ITEM_SAVE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###METHOD_ITEM_SAVE###'] = $this->setMethodItemSave($viewName_single); // ###POSTSAVEHOOK### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###POSTSAVEHOOK###'] = $this->getCustomScriptBuilder('php_postsavehook', $viewName_single, "\n", null, true, "\n\t\treturn;", "\n\n\t\treturn;"); if (isset($this->customScriptBuilder['css_view'][$viewName_single]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['css_view'][$viewName_single])) { // ###VIEWCSS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###VIEWCSS###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['css_view'][$viewName_single]); // clear some memory unset($this->customScriptBuilder['css_view'][$viewName_single]); } else { // ###VIEWCSS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###VIEWCSS###'] = ''; } // add css to front end if ($view['edit_create_site_view']) { $this->fileContentDynamic[$viewName_single]['###SITE_VIEWCSS###'] = $this->fileContentDynamic[$viewName_single]['###VIEWCSS###']; } } // set the views names if ($view['settings']->name_list != 'null') { $this->lang = 'admin'; // ###VIEWS### <<<DYNAMIC>>> $viewsName_u = ComponentbuilderHelper::safeString($view['settings']->name_list, 'U'); $this->fileContentDynamic[$viewName_list]['###VIEWS###'] = $viewsName_u; $this->fileContentDynamic[$viewName_single]['###VIEWS###'] = $viewsName_u; // ###Views### <<<DYNAMIC>>> $viewsName_f = ComponentbuilderHelper::safeString($view['settings']->name_list, 'F'); $this->fileContentDynamic[$viewName_list]['###Views###'] = $viewsName_f; $this->fileContentDynamic[$viewName_single]['###Views###'] = $viewsName_f; // ###views### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###views###'] = $viewName_list; $this->fileContentDynamic[$viewName_single]['###views###'] = $viewName_list; // ###ICOMOON### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###ICOMOON###'] = $view['icomoon']; // set some place holder for the views $this->placeholders['###views###'] = $viewName_list; $this->placeholders['###VIEWS###'] = $viewsName_u; $this->placeholders['###Views###'] = $viewsName_f; // set the export/import option if ($view['port']) { $this->eximportView[$viewName_list] = true; if (1 == $view['settings']->add_custom_import) { // this view has custom import scripting $this->importCustomScripts[$viewName_list] = true; $this->setImportCustomScripts($viewName_list); } } else { $this->eximportView[$viewName_list] = false; } // set Autocheckin function if ($view['checkin'] == 1) { // ###AUTOCHECKIN### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###AUTOCHECKIN###'] = $this->setAutoCheckin($viewName_single, $this->fileContentStatic['###component###']); // ###CHECKINCALL### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###CHECKINCALL###'] = $this->setCheckinCall(); } else { // ###AUTOCHECKIN### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###AUTOCHECKIN###'] = ''; // ###CHECKINCALL### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###CHECKINCALL###'] = ''; } // ###GET_ITEMS_METHOD_STRING_FIX### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_STRING_FIX###'] = $this->setGetItemsMethodStringFix($viewName_single, $this->fileContentStatic['###Component###']); // ###GET_ITEMS_METHOD_AFTER_ALL### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_AFTER_ALL###'] = $this->getCustomScriptBuilder('php_getitems_after_all', $viewName_single, "\n"); // ###SELECTIONTRANSLATIONFIX### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###SELECTIONTRANSLATIONFIX###'] = $this->setSelectionTranslationFix($viewName_list, $this->fileContentStatic['###Component###']); // ###SELECTIONTRANSLATIONFIXFUNC### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###SELECTIONTRANSLATIONFIXFUNC###'] = $this->setSelectionTranslationFixFunc($viewName_list, $this->fileContentStatic['###Component###']); // ###FILTER_FIELDS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###FILTER_FIELDS###'] = $this->setFilterFields($viewName_list); // ###STOREDID### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###STOREDID###'] = $this->setStoredId($viewName_list); // ###POPULATESTATE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###POPULATESTATE###'] = $this->setPopulateState($viewName_list); // ###SORTFIELDS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###SORTFIELDS###'] = $this->setSortFields($viewName_list); // ###CATEGORYFILTER### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###CATEGORYFILTER###'] = $this->setCategoryFilter($viewName_list); // ###CATEGORY_VIEWS### if (!isset($this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###'])) { $this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###'] = ''; } $this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###'] .= $this->setRouterCategoryViews($viewName_single, $viewName_list); // ###OTHERFILTERS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###OTHERFILTERS###'] = $this->setOtherFilter($viewName_list); // ###FILTERFUNCTIONS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###FILTERFUNCTIONS###'] = $this->setFilterFunctions($viewName_single, $viewName_list); // ###LISTQUERY### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###LISTQUERY###'] = $this->setListQuery($viewName_single, $viewName_list); // ###MODELEXPORTMETHOD### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###MODELEXPORTMETHOD###'] = $this->setModelExportMethod($viewName_single, $viewName_list); // ###MODELEXIMPORTMETHOD### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###CONTROLLEREXIMPORTMETHOD###'] = $this->setControllerEximportMethod($viewName_single, $viewName_list); // ###EXPORTBUTTON### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###EXPORTBUTTON###'] = $this->setExportButton($viewName_single, $viewName_list); // ###IMPORTBUTTON### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###IMPORTBUTTON###'] = $this->setImportButton($viewName_single, $viewName_list); // ###LISTHEAD### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###LISTHEAD###'] = $this->setListHead($viewName_single, $viewName_list); // ###LISTBODY### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###LISTBODY###'] = $this->setListBody($viewName_single, $viewName_list); // ###LISTCOLNR### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###LISTCOLNR###'] = $this->setListColnr($viewName_list); // ###JVIEWLISTCANDO### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###JVIEWLISTCANDO###'] = $this->setJviewListCanDo($viewName_single, $viewName_list); if (isset($this->customScriptBuilder['css_views'][$viewName_list]) && ComponentbuilderHelper::checkString($this->customScriptBuilder['css_views'][$viewName_list])) { // ###VIEWCSS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###VIEWSCSS###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['css_views'][$viewName_list]); // clear some memory unset($this->customScriptBuilder['css_views'][$viewName_list]); } else { // ###VIEWCSS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###VIEWSCSS###'] = ''; } } // set u fields used in batch $this->fileContentDynamic[$viewName_single]['###UNIQUEFIELDS###'] = $this->setUniqueFields($viewName_single); // ###TITLEALIASFIX### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###TITLEALIASFIX###'] = $this->setAliasTitleFix($viewName_single); // ###GENERATENEWTITLE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###GENERATENEWTITLE###'] = $this->setGenerateNewTitle($viewName_single); // ###MODEL_BATCH_COPY### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###MODEL_BATCH_COPY###'] = $this->setBatchCopy($viewName_single); // ###MODEL_BATCH_MOVE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###MODEL_BATCH_MOVE###'] = $this->setBatchMove($viewName_single); // ###BATCH_ONCLICK_CANCEL_SCRIPT### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###BATCH_ONCLICK_CANCEL_SCRIPT###'] = ''; // TODO <-- must still be build // ###JCONTROLLERFORM_ALLOWADD### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JCONTROLLERFORM_ALLOWADD###'] = $this->setJcontrollerAllowAdd($viewName_single, $viewName_list); // ###JCONTROLLERFORM_ALLOWEDIT### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JCONTROLLERFORM_ALLOWEDIT###'] = $this->setJcontrollerAllowEdit($viewName_single, $viewName_list); // ###JMODELADMIN_GETFORM### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_GETFORM###'] = $this->setJmodelAdminGetForm($viewName_single, $viewName_list); // ###JMODELADMIN_ALLOWEDIT### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_ALLOWEDIT###'] = $this->setJmodelAdminAllowEdit($viewName_single, $viewName_list); // ###JMODELADMIN_CANDELETE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_CANDELETE###'] = $this->setJmodelAdminCanDelete($viewName_single, $viewName_list); // ###JMODELADMIN_CANEDITSTATE### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_single]['###JMODELADMIN_CANEDITSTATE###'] = $this->setJmodelAdminCanEditState($viewName_single, $viewName_list); // set custom admin view Toolbare buttons // ###CUSTOM_ADMIN_DYNAMIC_BUTTONS### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###CUSTOM_ADMIN_DYNAMIC_BUTTONS###'] = $this->setCustomAdminDynamicButton($viewName_list); // ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER### <<<DYNAMIC>>> $this->fileContentDynamic[$viewName_list]['###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER###'] = $this->setCustomAdminDynamicButtonController($viewName_list); // set helper router if (!isset($this->fileContentStatic['###ROUTEHELPER###'])) { $this->fileContentStatic['###ROUTEHELPER###'] = ''; } $this->fileContentStatic['###ROUTEHELPER###'] .= $this->setRouterHelp($viewName_single, $viewName_list); if ($view['edit_create_site_view']) { // add needed router stuff for front edit views $this->fileContentStatic['###ROUTER_PARSE_SWITCH###'] .= $this->routerParseSwitch($viewName_single); $this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] .= $this->routerBuildViews($viewName_single); } // ###ACCESS_SECTIONS### if (!isset($this->fileContentStatic['###ACCESS_SECTIONS###'])) { $this->fileContentStatic['###ACCESS_SECTIONS###'] = ''; } $this->fileContentStatic['###ACCESS_SECTIONS###'] .= $this->setAccessSectionsCategory($viewName_single, $viewName_list); // ###HELPER_EXEL### $this->fileContentStatic['###HELPER_EXEL###'] = $this->setExelHelperMethods(); } // setup custom_admin_views and all needed stuff for the site if (isset($this->componentData->custom_admin_views) && ComponentbuilderHelper::checkArray($this->componentData->custom_admin_views)) { $this->target = 'custom_admin'; $this->lang = 'admin'; // var_dump($this->componentData->custom_admin_views);exit; // start dynamic build foreach ($this->componentData->custom_admin_views as $view) { // for single views $this->fileContentDynamic[$view['settings']->code]['###SView###'] = $view['settings']->Code; $this->fileContentDynamic[$view['settings']->code]['###sview###'] = $view['settings']->code; $this->fileContentDynamic[$view['settings']->code]['###SVIEW###'] = $view['settings']->CODE; // for list views $this->fileContentDynamic[$view['settings']->code]['###SViews###'] = $view['settings']->Code; $this->fileContentDynamic[$view['settings']->code]['###sviews###'] = $view['settings']->code; $this->fileContentDynamic[$view['settings']->code]['###SVIEWS###'] = $view['settings']->CODE; // add to lang array if (!isset($this->langContent[$this->lang][$this->langPrefix . '_' . $view['settings']->CODE])) { $this->langContent[$this->lang][$this->langPrefix . '_' . $view['settings']->CODE] = $view['settings']->name; } if (!isset($this->langContent[$this->lang][$this->langPrefix . '_' . $view['settings']->CODE . '_DESC'])) { $this->langContent[$this->lang][$this->langPrefix . '_' . $view['settings']->CODE . '_DESC'] = $view['settings']->description; } // ###ICOMOON### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###ICOMOON###'] = $view['icomoon']; // set placeholders $this->placeholders['###SView###'] = $view['settings']->Code; $this->placeholders['###sview###'] = $view['settings']->code; $this->placeholders['###SVIEW###'] = $view['settings']->CODE; $this->placeholders['[[[SView]]]'] = $view['settings']->Code; $this->placeholders['[[[sview]]]'] = $view['settings']->code; $this->placeholders['[[[SVIEW]]]'] = $view['settings']->CODE; $this->placeholders['###SViews###'] = $view['settings']->Code; $this->placeholders['###sviews###'] = $view['settings']->code; $this->placeholders['###SVIEWS###'] = $view['settings']->CODE; $this->placeholders['[[[SViews]]]'] = $view['settings']->Code; $this->placeholders['[[[sviews]]]'] = $view['settings']->code; $this->placeholders['[[[SVIEWS]]]'] = $view['settings']->CODE; // set license per view if needed $this->setLockLicensePer($view['settings']->code); if ($view['settings']->main_get->gettype == 1) { // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code])) { // ###CUSTOM_ADMIN_BEFORE_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEM###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]); } else { // ###CUSTOM_ADMIN_BEFORE_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEM###'] = ''; } // ###CUSTOM_ADMIN_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_GET_ITEM###'] = $this->setCustomViewGetItem($view['settings']->main_get, $view['settings']->code, "\t\t"); // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code])) { // ###CUSTOM_ADMIN_AFTER_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEM###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]); } else { // ###CUSTOM_ADMIN_AFTER_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEM###'] = ''; } } elseif ($view['settings']->main_get->gettype == 2) { // ###CUSTOM_ADMIN_GET_LIST_QUERY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_GET_LIST_QUERY###'] = $this->setCustomViewListQuery($view['settings']->main_get, $view['settings']->code); // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code])) { // ###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY###'] = "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_getlistquery'][$view['settings']->code]); } else { // ###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_BEFORE_LIST_QUERY###'] = ''; } // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code])) { // ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEMS###'] = "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]); } else { // ###CUSTOM_ADMIN_BEFORE_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BEFORE_GET_ITEMS###'] = ''; } // ###CUSTOM_ADMIN_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_GET_ITEMS###'] = $this->setCustomViewGetItems($view['settings']->main_get, $view['settings']->code); // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code])) { // ###CUSTOM_ADMIN_AFTER_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEMS###'] = "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]); } else { // ###CUSTOM_ADMIN_AFTER_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_AFTER_GET_ITEMS###'] = ''; } } // ###CUSTOM_ADMIN_CUSTOM_METHODS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_METHODS###'] = $this->setCustomViewCustomItemMethods($view['settings']->main_get, $view['settings']->code); $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CUSTOM_METHODS###'] .= $this->setCustomViewCustomMethods($view, $view['settings']->code); // ###CUSTOM_ADMIN_DIPLAY_METHOD### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_DIPLAY_METHOD###'] = $this->setCustomViewDisplayMethod($view); // set document details $this->setPrepareDocument($view); // ###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###'] = $this->setCustomViewExtraDisplayMethods($view); // ###CUSTOM_ADMIN_CODE_BODY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_CODE_BODY###'] = $this->setCustomViewCodeBody($view); // ###CUSTOM_ADMIN_BODY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_BODY###'] = $this->setCustomViewBody($view); // ###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###CUSTOM_ADMIN_SUBMITBUTTON_SCRIPT###'] = $this->setCustomViewSubmitButtonScript($view); // setup the templates $this->setCustomViewTemplateBody($view); } // setup the layouts $this->setCustomViewLayouts(); } // ###VIEWARRAY### $this->fileContentStatic['###VIEWARRAY###'] = "\n" . implode(",\n", $viewarray); // ###CUSTOM_ADMIN_EDIT_VIEW_ARRAY### $this->fileContentStatic['###SITE_EDIT_VIEW_ARRAY###'] = "\n" . implode(",\n", $site_edit_view_array); // ###MAINMENUS### $this->fileContentStatic['###MAINMENUS###'] = $this->setMainMenus(); // ###SUBMENU### $this->fileContentStatic['###SUBMENU###'] = $this->setSubMenus(); // ###GET_CRYPT_KEY### $this->fileContentStatic['###GET_CRYPT_KEY###'] = $this->setGetCryptKey(); // set the license locker $this->setLockLicense(); // ###CONTRIBUTORS### $this->fileContentStatic['###CONTRIBUTORS###'] = $this->theContributors; // ###INSTALL### $this->fileContentStatic['###INSTALL###'] = $this->setInstall(); // ###UNINSTALL### $this->fileContentStatic['###UNINSTALL###'] = $this->setUninstall(); // ###DASHBOARDICONS### $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASHBOARDICONS###'] = $this->setDashboardIcons(); // ###DASHBOARDICONACCESS### $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASHBOARDICONACCESS###'] = $this->setDashboardIconAccess(); // ###DASH_MODEL_METHODS### $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_MODEL_METHODS###'] = $this->setDashboardModelMethods(); // ###DASH_GET_CUSTOM_DATA### $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_GET_CUSTOM_DATA###'] = $this->setDashboardGetCustomData(); // ###DASH_DISPLAY_DATA### $this->fileContentDynamic[$this->fileContentStatic['###component###']]['###DASH_DISPLAY_DATA###'] = $this->setDashboardDisplayData(); // add import if (isset($this->addEximport) && $this->addEximport) { // setup import files $target = array('admin' => 'import'); $this->buildDynamique($target, 'import'); // set the controller $this->fileContentDynamic['import']['###BLABLABLA###'] = ''; } // ensure that the ajax model and controller is set if needed if (isset($this->addAjax) && $this->addAjax) { // setup Ajax files $target = array('admin' => 'ajax'); $this->buildDynamique($target, 'ajax'); // set the controller $this->fileContentDynamic['ajax']['###REGISTER_AJAX_TASK###'] = $this->setRegisterAjaxTask('admin'); $this->fileContentDynamic['ajax']['###AJAX_INPUT_RETURN###'] = $this->setAjaxInputReturn('admin'); // set the module $this->fileContentDynamic['ajax']['###AJAX_MODEL_METHODS###'] = $this->setAjaxModelMethods('admin'); } // ensure that the site ajax model and controller is set if needed if (isset($this->addSiteAjax) && $this->addSiteAjax) { // setup Ajax files $target = array('site' => 'ajax'); $this->buildDynamique($target, 'ajax'); // set the controller $this->fileContentDynamic['ajax']['###REGISTER_SITE_AJAX_TASK###'] = $this->setRegisterAjaxTask('site'); $this->fileContentDynamic['ajax']['###AJAX_SITE_INPUT_RETURN###'] = $this->setAjaxInputReturn('site'); // set the module $this->fileContentDynamic['ajax']['###AJAX_SITE_MODEL_METHODS###'] = $this->setAjaxModelMethods('site'); } // run the second run if needed if (isset($this->secondRunAdmin) && ComponentbuilderHelper::checkArray($this->secondRunAdmin)) { // start dynamic build foreach ($this->secondRunAdmin as $function => $arrays) { if (ComponentbuilderHelper::checkArray($arrays) && ComponentbuilderHelper::checkString($function)) { foreach ($arrays as $array) { $this->{$function}($array); } } } } // ###CONFIG_FIELDSETS### $keepLang = $this->lang; $this->lang = 'admin'; // run field sets for second time $this->setConfigFieldsets(2); $this->lang = $keepLang; // setup front-views and all needed stuff for the site if (isset($this->componentData->site_views) && ComponentbuilderHelper::checkArray($this->componentData->site_views)) { $this->target = 'site'; // var_dump($this->componentData->site_views);exit; // start dynamic build foreach ($this->componentData->site_views as $view) { // for list views $this->fileContentDynamic[$view['settings']->code]['###SViews###'] = $view['settings']->Code; $this->fileContentDynamic[$view['settings']->code]['###sviews###'] = $view['settings']->code; // for single views $this->fileContentDynamic[$view['settings']->code]['###SView###'] = $view['settings']->Code; $this->fileContentDynamic[$view['settings']->code]['###sview###'] = $view['settings']->code; // set placeholder $this->placeholders['###SView###'] = $view['settings']->Code; $this->placeholders['###sview###'] = $view['settings']->code; $this->placeholders['###SVIEW###'] = $view['settings']->CODE; $this->placeholders['[[[SView]]]'] = $view['settings']->Code; $this->placeholders['[[[sview]]]'] = $view['settings']->code; $this->placeholders['[[[SVIEW]]]'] = $view['settings']->CODE; $this->placeholders['###SViews###'] = $view['settings']->Code; $this->placeholders['###sviews###'] = $view['settings']->code; $this->placeholders['###SVIEWS###'] = $view['settings']->CODE; $this->placeholders['[[[SViews]]]'] = $view['settings']->Code; $this->placeholders['[[[sviews]]]'] = $view['settings']->code; $this->placeholders['[[[SVIEWS]]]'] = $view['settings']->CODE; // set license per view if needed $this->setLockLicensePer($view['settings']->code); // set the site default view if ($view['default_view'] == 1) { $this->fileContentStatic['###SITE_DEFAULT_VIEW###'] = $view['settings']->code; } // add site menu if ($view['menu'] == 1) { // ###SITE_MENU_XML### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_MENU_XML###'] = $this->setCustomViewMenu($view); } // insure the needed route helper is loaded $this->fileContentStatic['###ROUTEHELPER###'] .= $this->setRouterHelp($view['settings']->code, $view['settings']->code, true); // build route details $this->fileContentStatic['###ROUTER_PARSE_SWITCH###'] .= $this->routerParseSwitch($view['settings']->code); $this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] .= $this->routerBuildViews($view['settings']->code); if ($view['settings']->main_get->gettype == 1) { // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code])) { // ###SITE_BEFORE_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEM###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_before_getitem'][$view['settings']->code]); } else { // ###SITE_BEFORE_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEM###'] = ''; } // ###SITE_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_GET_ITEM###'] = $this->setCustomViewGetItem($view['settings']->main_get, $view['settings']->code, "\t\t"); // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code])) { // ###SITE_AFTER_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEM###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_after_getitem'][$view['settings']->code]); } else { // ###SITE_AFTER_GET_ITEM### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEM###'] = ''; } } elseif ($view['settings']->main_get->gettype == 2) { // ###SITE_GET_LIST_QUERY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_GET_LIST_QUERY###'] = $this->setCustomViewListQuery($view['settings']->main_get, $view['settings']->code); // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code])) { // ###SITE_BEFORE_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEMS###'] = "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_before_getitems'][$view['settings']->code]); } else { // ###SITE_BEFORE_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_BEFORE_GET_ITEMS###'] = ''; } // ###SITE_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_GET_ITEMS###'] = $this->setCustomViewGetItems($view['settings']->main_get, $view['settings']->code); // check if there is any custom script if (isset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]) && ComponentbuilderHelper::checkString($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code])) { // ###SITE_AFTER_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEMS###'] = "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]); // clear some memory unset($this->customScriptBuilder[$this->target . '_php_after_getitems'][$view['settings']->code]); } else { // ###SITE_AFTER_GET_ITEMS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_AFTER_GET_ITEMS###'] = ''; } } // add to lang array if (!isset($this->langContent['site'][$this->langPrefix . '_' . $view['settings']->CODE])) { $this->langContent['site'][$this->langPrefix . '_' . $view['settings']->CODE] = $view['settings']->name; } if (!isset($this->langContent['site'][$this->langPrefix . '_' . $view['settings']->CODE . '_DESC'])) { $this->langContent['site'][$this->langPrefix . '_' . $view['settings']->CODE . '_DESC'] = $view['settings']->description; } // ###SITE_CUSTOM_METHODS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_CUSTOM_METHODS###'] = $this->setCustomViewCustomItemMethods($view['settings']->main_get, $view['settings']->code); $this->fileContentDynamic[$view['settings']->code]['###SITE_CUSTOM_METHODS###'] .= $this->setCustomViewCustomMethods($view, $view['settings']->code); // ###SITE_DIPLAY_METHOD### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_DIPLAY_METHOD###'] = $this->setCustomViewDisplayMethod($view); // set document details $this->setPrepareDocument($view); // ###SITE_EXTRA_DIPLAY_METHODS### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_EXTRA_DIPLAY_METHODS###'] = $this->setCustomViewExtraDisplayMethods($view); // ###SITE_CODE_BODY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_CODE_BODY###'] = $this->setCustomViewCodeBody($view); // ###SITE_BODY### <<<DYNAMIC>>> $this->fileContentDynamic[$view['settings']->code]['###SITE_BODY###'] = $this->setCustomViewBody($view); // setup the templates $this->setCustomViewTemplateBody($view); } // set site custom script to helper class // ###SITE_CUSTOM_HELPER_SCRIPT### $this->fileContentStatic['###SITE_CUSTOM_HELPER_SCRIPT###'] = str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['component_php_helper_site']); // ###SITE_GLOBAL_EVENT_HELPER### $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] = ''; // ###SITE_GLOBAL_EVENT### $this->fileContentStatic['###SITE_GLOBAL_EVENT###'] = ''; // now load the data for the global event if needed if ($this->componentData->add_site_event == 1) { $this->fileContentStatic['###SITE_GLOBAL_EVENT###'] = "\n\n" . '// Triger the Global Site Event'; $this->fileContentStatic['###SITE_GLOBAL_EVENT###'] .= "\n" . $this->fileContentStatic['###Component###'] . 'Helper::globalEvent($document);'; // ###SITE_GLOBAL_EVENT_HELPER### $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] = "\n\n\t" . '/**'; $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '* The Global Site Event Method.'; $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '**/'; $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t" . 'public static function globalEvent($document)'; $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '{'; $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n" . str_replace(array_keys($this->placeholders), array_values($this->placeholders), $this->customScriptBuilder['component_php_site_event']); $this->fileContentStatic['###SITE_GLOBAL_EVENT_HELPER###'] .= "\n\t" . '}'; } // setup the layouts $this->setCustomViewLayouts(); } // ###LANG_ADMIN### $this->fileContentStatic['###LANG_ADMIN###'] = $this->setLangAdmin(); // ###LANG_ADMIN_SYS### $this->fileContentStatic['###LANG_ADMIN_SYS###'] = $this->setLangAdminSys(); // ###LANG_SITE### $this->fileContentStatic['###LANG_SITE###'] = $this->setLangSite(); // ###LANG_SITE_SYS### $this->fileContentStatic['###LANG_SITE_SYS###'] = $this->setLangSiteSys(); // ###PREINSTALLSCRIPT### $this->fileContentStatic['###PREINSTALLSCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'install', "\n", null, true); // ###PREUPDATESCRIPT### $this->fileContentStatic['###PREUPDATESCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'update', "\n", null, true); // ###POSTINSTALLSCRIPT### $this->fileContentStatic['###POSTINSTALLSCRIPT###'] = $this->setPostInstallScript(); // ###POSTUPDATESCRIPT### $this->fileContentStatic['###POSTUPDATESCRIPT###'] = $this->setPostUpdateScript(); // ###UNINSTALLSCRIPT### $this->fileContentStatic['###UNINSTALLSCRIPT###'] = $this->setUninstallScript(); // ###HELPER_UIKIT### $this->fileContentStatic['###HELPER_UIKIT###'] = $this->setUikitHelperMethods(); // ###CONFIG_FIELDSETS### $this->fileContentStatic['###CONFIG_FIELDSETS###'] = implode("\n", $this->configFieldSets); // check if this has been set if (!isset($this->fileContentStatic['###ROUTER_BUILD_VIEWS###']) || !ComponentbuilderHelper::checkString($this->fileContentStatic['###ROUTER_BUILD_VIEWS###'])) { $this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] = 0; } else { $this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] = '(' . $this->fileContentStatic['###ROUTER_BUILD_VIEWS###'] . ')'; } // ###README### if ($this->componentData->addreadme) { $this->fileContentStatic['###README###'] = $this->componentData->readme; } return true; } return false; }
$can = ComponentbuilderHelper::getActions('site_view'); ?> <div class="form-vertical"> <?php if ($can->get('core.create')) { ?> <a class="btn btn-small btn-success" href="<?php echo $new; ?> "><span class="icon-new icon-white"></span> <?php echo JText::_('COM_COMPONENTBUILDER_NEW'); ?> </a><br /><br /> <?php } if (ComponentbuilderHelper::checkArray($items)) { ?> <table class="footable table data site_views" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true"> <thead> <tr> <th data-type="html" data-sort-use="text"> <?php echo JText::_('COM_COMPONENTBUILDER_SITE_VIEW_SYSTEM_NAME_LABEL'); ?> </th> <th data-breakpoints="xs sm" data-type="html" data-sort-use="text"> <?php echo JText::_('COM_COMPONENTBUILDER_SITE_VIEW_NAME_LABEL'); ?> </th> <th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the custom_get items to data. if (isset($data['custom_get']) && is_array($data['custom_get'])) { $custom_get = new JRegistry(); $custom_get->loadArray($data['custom_get']); $data['custom_get'] = (string) $custom_get; } elseif (!isset($data['custom_get'])) { // Set the empty custom_get to data $data['custom_get'] = ''; } // Set the php_model string to base64 string. if (isset($data['php_model'])) { $data['php_model'] = base64_encode($data['php_model']); } // Set the css_document string to base64 string. if (isset($data['css_document'])) { $data['css_document'] = base64_encode($data['css_document']); } // Set the php_jview string to base64 string. if (isset($data['php_jview'])) { $data['php_jview'] = base64_encode($data['php_jview']); } // Set the php_view string to base64 string. if (isset($data['php_view'])) { $data['php_view'] = base64_encode($data['php_view']); } // Set the php_document string to base64 string. if (isset($data['php_document'])) { $data['php_document'] = base64_encode($data['php_document']); } // Set the php_jview_display string to base64 string. if (isset($data['php_jview_display'])) { $data['php_jview_display'] = base64_encode($data['php_jview_display']); } // Set the js_document string to base64 string. if (isset($data['js_document'])) { $data['js_document'] = base64_encode($data['js_document']); } // Set the css string to base64 string. if (isset($data['css'])) { $data['css'] = base64_encode($data['css']); } // Set the default string to base64 string. if (isset($data['default'])) { $data['default'] = base64_encode($data['default']); } // Set the php_controller string to base64 string. if (isset($data['php_controller'])) { $data['php_controller'] = base64_encode($data['php_controller']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the name for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['name'] == $origTable->name) { list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); $data['name'] = $name; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['published'] = 0; } // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { if ($data['alias'] == null) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); } else { $data['alias'] = JFilterOutput::stringURLSafe($data['name']); } $table = JTable::getInstance('custom_admin_view', 'componentbuilderTable'); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { $msg = JText::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SAVE_WARNING'); } list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); $data['alias'] = $alias; if (isset($msg)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); } } } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the groups string to JSON string. if (isset($data['groups'])) { $data['groups'] = (string) json_encode($data['groups']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the title for save as copy if ($input->get('task') == 'save2copy') { $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['title'] == $origTable->title) { list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); $data['title'] = $title; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['published'] = 0; } // Automatic handling of alias for empty fields if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) { if ($data['alias'] == null) { if (JFactory::getConfig()->get('unicodeslugs') == 1) { $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']); } else { $data['alias'] = JFilterOutput::stringURLSafe($data['title']); } $table = JTable::getInstance('help_document', 'componentbuilderTable'); if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) { $msg = JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SAVE_WARNING'); } list($title, $alias) = $this->_generateNewTitle($data['alias'], $data['title']); $data['alias'] = $alias; if (isset($msg)) { JFactory::getApplication()->enqueueMessage($msg, 'warning'); } } } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
public function getDbTableColumns($tableName, $as, $type) { // Get a db connection. $db = JFactory::getDbo(); // get the columns $columns = $db->getTableColumns("#__" . $tableName); if (ComponentbuilderHelper::checkArray($columns)) { // build the return string $tableColumns = array(); foreach ($columns as $column => $type) { $tableColumns[] = $as . "." . $column . ' AS ' . $column; } return implode("\n", $tableColumns); } return false; }
/** * Save the data from the file to the database * * @param string $package Paths to the uploaded package file * * @return boolean false on failure * **/ protected function save($data, $table) { // import the data if there is any if (ComponentbuilderHelper::checkArray($data['array'])) { // get user object $user = JFactory::getUser(); // remove header if it has headers $id_key = $data['target_headers']['id']; $published_key = $data['target_headers']['published']; $ordering_key = $data['target_headers']['ordering']; // get the first array set $firstSet = reset($data['array']); // check if first array is a header array and remove if true if ($firstSet[$id_key] == 'id' || $firstSet[$published_key] == 'published' || $firstSet[$ordering_key] == 'ordering') { array_shift($data['array']); } // make sure there is still values in array and that it was not only headers if (ComponentbuilderHelper::checkArray($data['array']) && $user->authorise($table . '.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { // set target. $target = array_flip($data['target_headers']); // Get a db connection. $db = JFactory::getDbo(); // set some defaults $todayDate = JFactory::getDate()->toSql(); // get global action permissions $canDo = ComponentbuilderHelper::getActions($table); $canEdit = $canDo->get('core.edit'); $canState = $canDo->get('core.edit.state'); $canCreate = $canDo->get('core.create'); $hasAlias = $this->getAliasesUsed($table); // prosses the data foreach ($data['array'] as $row) { $found = false; if (isset($row[$id_key]) && is_numeric($row[$id_key]) && $row[$id_key] > 0) { // raw items import & update! $query = $db->getQuery(true); $query->select('version')->from($db->quoteName('#__componentbuilder_' . $table))->where($db->quoteName('id') . ' = ' . $db->quote($row[$id_key])); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); $found = $db->getNumRows(); } if ($found && $canEdit) { // update item $id = $row[$id_key]; $version = $db->loadResult(); // reset all buckets $query = $db->getQuery(true); $fields = array(); // Fields to update. foreach ($row as $key => $cell) { // ignore column if ('IGNORE' == $target[$key]) { continue; } // update modified if ('modified_by' == $target[$key]) { continue; } // update modified if ('modified' == $target[$key]) { continue; } // update version if ('version' == $target[$key]) { $cell = (int) $version + 1; } // verify publish authority if ('published' == $target[$key] && !$canState) { continue; } // set to update array if (in_array($key, $data['target_headers']) && is_numeric($cell)) { $fields[] = $db->quoteName($target[$key]) . ' = ' . $cell; } elseif (in_array($key, $data['target_headers']) && is_string($cell)) { $fields[] = $db->quoteName($target[$key]) . ' = ' . $db->quote($cell); } elseif (in_array($key, $data['target_headers']) && is_null($cell)) { // if import data is null then set empty $fields[] = $db->quoteName($target[$key]) . " = ''"; } } // load the defaults $fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id); $fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate); // Conditions for which records should be updated. $conditions = array($db->quoteName('id') . ' = ' . $id); $query->update($db->quoteName('#__componentbuilder_' . $table))->set($fields)->where($conditions); $db->setQuery($query); $db->execute(); } elseif ($canCreate) { // insert item $query = $db->getQuery(true); // reset all buckets $columns = array(); $values = array(); $version = false; // Insert columns. Insert values. foreach ($row as $key => $cell) { // ignore column if ('IGNORE' == $target[$key]) { continue; } // remove id if ('id' == $target[$key]) { continue; } // update created if ('created_by' == $target[$key]) { continue; } // update created if ('created' == $target[$key]) { continue; } // Make sure the alias is incremented if ('alias' == $target[$key]) { $cell = $this->getAlias($cell, $table); } // update version if ('version' == $target[$key]) { $cell = 1; $version = true; } // set to insert array if (in_array($key, $data['target_headers']) && is_numeric($cell)) { $columns[] = $target[$key]; $values[] = $cell; } elseif (in_array($key, $data['target_headers']) && is_string($cell)) { $columns[] = $target[$key]; $values[] = $db->quote($cell); } elseif (in_array($key, $data['target_headers']) && is_null($cell)) { // if import data is null then set empty $columns[] = $target[$key]; $values[] = "''"; } } // load the defaults $columns[] = 'created_by'; $values[] = $db->quote($user->id); $columns[] = 'created'; $values[] = $db->quote($todayDate); if (!$version) { $columns[] = 'version'; $values[] = 1; } // Prepare the insert query. $query->insert($db->quoteName('#__componentbuilder_' . $table))->columns($db->quoteName($columns))->values(implode(',', $values)); // Set the query using our newly populated query object and execute it. $db->setQuery($query); $done = $db->execute(); if ($done) { $aId = $db->insertid(); // make sure the access of asset is set ComponentbuilderHelper::setAsset($aId, $table); } } else { return false; } } return true; } } return false; }
<div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> </div> <div id="j-main-container" class="span10"> <?php } else { ?> <div id="j-main-container"> <?php } ?> <?php if ($this->hasPackage && ComponentbuilderHelper::checkArray($this->headerList) && ComponentbuilderHelper::checkArray($this->headers)) { ?> <fieldset class="uploadform"> <legend><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS'); ?> </legend> <div class="control-group"> <label class="control-label" ><h4><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_TABLE_COLUMNS'); ?> </h4></label> <div class="controls"> <label class="control-label" ><h4><?php echo JText::_('COM_COMPONENTBUILDER_IMPORT_FILE_COLUMNS'); ?>
</a></li> <li><b><?php echo JText::_('COM_COMPONENTBUILDER_LICENSE'); ?> :</b> <?php echo $manifest->license; ?> </li> <li><b><?php echo $manifest->copyright; ?> </b></li> </ul> <div class="clearfix"></div> <?php if (ComponentbuilderHelper::checkArray($this->contributors)) { if (count($this->contributors) > 1) { ?> <h3><?php echo JText::_('COM_COMPONENTBUILDER_CONTRIBUTORS'); ?> </h3> <?php } else { ?> <h3><?php echo JText::_('COM_COMPONENTBUILDER_CONTRIBUTOR'); ?> </h3> <?php }
public function getIcons() { // load user for access menus $user = JFactory::getUser(); // reset icon array $icons = array(); // view groups array $viewGroups = array('main' => array('png.compiler', 'png.component.add', 'png.components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.help_document.add', 'png.help_documents')); // view access array $viewAccess = array('admin_views.access' => 'admin_view.access', 'admin_view.access' => 'admin_view.access', 'admin_views.submenu' => 'admin_view.submenu', 'admin_views.dashboard_list' => 'admin_view.dashboard_list', 'admin_view.dashboard_add' => 'admin_view.dashboard_add', 'custom_admin_views.access' => 'custom_admin_view.access', 'custom_admin_view.access' => 'custom_admin_view.access', 'custom_admin_views.submenu' => 'custom_admin_view.submenu', 'custom_admin_views.dashboard_list' => 'custom_admin_view.dashboard_list', 'custom_admin_view.dashboard_add' => 'custom_admin_view.dashboard_add', 'site_views.access' => 'site_view.access', 'site_view.access' => 'site_view.access', 'site_views.submenu' => 'site_view.submenu', 'site_views.dashboard_list' => 'site_view.dashboard_list', 'site_view.dashboard_add' => 'site_view.dashboard_add', 'templates.access' => 'template.access', 'template.access' => 'template.access', 'templates.submenu' => 'template.submenu', 'templates.dashboard_list' => 'template.dashboard_list', 'template.dashboard_add' => 'template.dashboard_add', 'layouts.access' => 'layout.access', 'layout.access' => 'layout.access', 'layouts.submenu' => 'layout.submenu', 'layouts.dashboard_list' => 'layout.dashboard_list', 'layout.dashboard_add' => 'layout.dashboard_add', 'dynamic_get.create' => 'dynamic_get.create', 'dynamic_gets.access' => 'dynamic_get.access', 'dynamic_get.access' => 'dynamic_get.access', 'dynamic_gets.submenu' => 'dynamic_get.submenu', 'dynamic_gets.dashboard_list' => 'dynamic_get.dashboard_list', 'dynamic_get.dashboard_add' => 'dynamic_get.dashboard_add', 'snippets.access' => 'snippet.access', 'snippet.access' => 'snippet.access', 'snippets.submenu' => 'snippet.submenu', 'snippets.dashboard_list' => 'snippet.dashboard_list', 'snippet.dashboard_add' => 'snippet.dashboard_add', 'field.create' => 'field.create', 'fields.access' => 'field.access', 'field.access' => 'field.access', 'fields.submenu' => 'field.submenu', 'fields.dashboard_list' => 'field.dashboard_list', 'field.dashboard_add' => 'field.dashboard_add', 'fieldtype.create' => 'fieldtype.create', 'fieldtypes.access' => 'fieldtype.access', 'fieldtype.access' => 'fieldtype.access', 'fieldtypes.submenu' => 'fieldtype.submenu', 'fieldtypes.dashboard_list' => 'fieldtype.dashboard_list', 'fieldtype.dashboard_add' => 'fieldtype.dashboard_add', 'help_document.create' => 'help_document.create', 'help_documents.access' => 'help_document.access', 'help_document.access' => 'help_document.access', 'help_documents.submenu' => 'help_document.submenu', 'help_documents.dashboard_list' => 'help_document.dashboard_list', 'help_document.dashboard_add' => 'help_document.dashboard_add'); foreach ($viewGroups as $group => $views) { $i = 0; if (ComponentbuilderHelper::checkArray($views)) { foreach ($views as $view) { $add = false; if (strpos($view, '.') !== false) { $dwd = explode('.', $view); if (count($dwd) == 3) { list($type, $name, $action) = $dwd; } elseif (count($dwd) == 2) { list($type, $name) = $dwd; $action = false; } if ($action) { $viewName = $name; switch ($action) { case 'add': $url = 'index.php?option=com_componentbuilder&view=' . $name . '&layout=edit'; $image = $name . '_' . $action . '.' . $type; $alt = $name . ' ' . $action; $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name, 'U') . '_ADD'; $add = true; break; default: $url = 'index.php?option=com_categories&view=categories&extension=com_componentbuilder.' . $name; $image = $name . '_' . $action . '.' . $type; $alt = $name . ' ' . $action; $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name, 'U') . '_' . ComponentbuilderHelper::safeString($action, 'U'); break; } } else { $viewName = $name; $alt = $name; $url = 'index.php?option=com_componentbuilder&view=' . $name; $image = $name . '.' . $type; $name = 'COM_COMPONENTBUILDER_DASHBOARD_' . ComponentbuilderHelper::safeString($name, 'U'); $hover = false; } } else { $viewName = $view; $alt = $view; $url = 'index.php?option=com_componentbuilder&view=' . $view; $image = $view . '.png'; $name = ucwords($view) . '<br /><br />'; $hover = false; } // first make sure the view access is set if (ComponentbuilderHelper::checkArray($viewAccess)) { // setup some defaults $dashboard_add = false; $dashboard_list = false; $accessTo = ''; $accessAdd = ''; // acces checking start $accessCreate = isset($viewAccess[$viewName . '.create']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.create']) : false; $accessAccess = isset($viewAccess[$viewName . '.access']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.access']) : false; // set main controllers $accessDashboard_add = isset($viewAccess[$viewName . '.dashboard_add']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.dashboard_add']) : false; $accessDashboard_list = isset($viewAccess[$viewName . '.dashboard_list']) ? ComponentbuilderHelper::checkString($viewAccess[$viewName . '.dashboard_list']) : false; // check for adding access if ($add && $accessCreate) { $accessAdd = $viewAccess[$viewName . '.create']; } elseif ($add) { $accessAdd = 'core.create'; } // check if acces to view is set if ($accessAccess) { $accessTo = $viewAccess[$viewName . '.access']; } // set main access controllers if ($accessDashboard_add) { $dashboard_add = $user->authorise($viewAccess[$viewName . '.dashboard_add'], 'com_componentbuilder'); } if ($accessDashboard_list) { $dashboard_list = $user->authorise($viewAccess[$viewName . '.dashboard_list'], 'com_componentbuilder'); } if (ComponentbuilderHelper::checkString($accessAdd) && ComponentbuilderHelper::checkString($accessTo)) { // check access if ($user->authorise($accessAdd, 'com_componentbuilder') && $user->authorise($accessTo, 'com_componentbuilder') && $dashboard_add) { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } elseif (ComponentbuilderHelper::checkString($accessTo)) { // check access if ($user->authorise($accessTo, 'com_componentbuilder') && $dashboard_list) { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } elseif (ComponentbuilderHelper::checkString($accessAdd)) { // check access if ($user->authorise($accessAdd, 'com_componentbuilder') && $dashboard_add) { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } else { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } } else { $icons[$group][$i] = new StdClass(); $icons[$group][$i]->url = $url; $icons[$group][$i]->name = $name; $icons[$group][$i]->image = $image; $icons[$group][$i]->alt = $alt; } $i++; } } else { $icons[$group][$i] = false; } } return $icons; }
private function getFTP($clientInput) { $signature = md5($clientInput); if (isset($this->FTP[$signature]) && $this->FTP[$signature] instanceof JClientFtp) { return $this->FTP[$signature]; } else { // make sure we have a string and it is not default or empty if (ComponentbuilderHelper::checkString($clientInput)) { // turn into vars parse_str($clientInput); // set options if (isset($options) && ComponentbuilderHelper::checkArray($options)) { foreach ($options as $option => $value) { if ('timeout' == $option) { $options[$option] = (int) $value; } if ('type' == $option) { $options[$option] = (string) $value; } } } else { $options = array(); } // get ftp object if (isset($host) && $host != 'HOSTNAME' && isset($port) && $port != 'PORT_INT' && isset($username) && $username != '*****@*****.**' && isset($password) && $password != 'password') { // load for reuse $this->FTP[$signature] = JClientFtp::getInstance($host, $port, $options, $username, $password); return $this->FTP[$signature]; } } } return false; }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the php_after_delete string to base64 string. if (isset($data['php_after_delete'])) { $data['php_after_delete'] = base64_encode($data['php_after_delete']); } // Set the php_save string to base64 string. if (isset($data['php_save'])) { $data['php_save'] = base64_encode($data['php_save']); } // Set the php_batchmove string to base64 string. if (isset($data['php_batchmove'])) { $data['php_batchmove'] = base64_encode($data['php_batchmove']); } // Set the php_getitems_after_all string to base64 string. if (isset($data['php_getitems_after_all'])) { $data['php_getitems_after_all'] = base64_encode($data['php_getitems_after_all']); } // Set the php_allowedit string to base64 string. if (isset($data['php_allowedit'])) { $data['php_allowedit'] = base64_encode($data['php_allowedit']); } // Set the php_after_publish string to base64 string. if (isset($data['php_after_publish'])) { $data['php_after_publish'] = base64_encode($data['php_after_publish']); } // Set the php_import_setdata string to base64 string. if (isset($data['php_import_setdata'])) { $data['php_import_setdata'] = base64_encode($data['php_import_setdata']); } // Set the php_getitems string to base64 string. if (isset($data['php_getitems'])) { $data['php_getitems'] = base64_encode($data['php_getitems']); } // Set the php_getlistquery string to base64 string. if (isset($data['php_getlistquery'])) { $data['php_getlistquery'] = base64_encode($data['php_getlistquery']); } // Set the php_postsavehook string to base64 string. if (isset($data['php_postsavehook'])) { $data['php_postsavehook'] = base64_encode($data['php_postsavehook']); } // Set the php_batchcopy string to base64 string. if (isset($data['php_batchcopy'])) { $data['php_batchcopy'] = base64_encode($data['php_batchcopy']); } // Set the php_before_publish string to base64 string. if (isset($data['php_before_publish'])) { $data['php_before_publish'] = base64_encode($data['php_before_publish']); } // Set the php_before_delete string to base64 string. if (isset($data['php_before_delete'])) { $data['php_before_delete'] = base64_encode($data['php_before_delete']); } // Set the php_document string to base64 string. if (isset($data['php_document'])) { $data['php_document'] = base64_encode($data['php_document']); } // Set the sql string to base64 string. if (isset($data['sql'])) { $data['sql'] = base64_encode($data['sql']); } // Set the php_import_display string to base64 string. if (isset($data['php_import_display'])) { $data['php_import_display'] = base64_encode($data['php_import_display']); } // Set the php_import string to base64 string. if (isset($data['php_import'])) { $data['php_import'] = base64_encode($data['php_import']); } // Set the css_view string to base64 string. if (isset($data['css_view'])) { $data['css_view'] = base64_encode($data['css_view']); } // Set the css_views string to base64 string. if (isset($data['css_views'])) { $data['css_views'] = base64_encode($data['css_views']); } // Set the javascript_view_file string to base64 string. if (isset($data['javascript_view_file'])) { $data['javascript_view_file'] = base64_encode($data['javascript_view_file']); } // Set the javascript_view_footer string to base64 string. if (isset($data['javascript_view_footer'])) { $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); } // Set the javascript_views_file string to base64 string. if (isset($data['javascript_views_file'])) { $data['javascript_views_file'] = base64_encode($data['javascript_views_file']); } // Set the javascript_views_footer string to base64 string. if (isset($data['javascript_views_footer'])) { $data['javascript_views_footer'] = base64_encode($data['javascript_views_footer']); } // Set the php_controller string to base64 string. if (isset($data['php_controller'])) { $data['php_controller'] = base64_encode($data['php_controller']); } // Set the php_model string to base64 string. if (isset($data['php_model'])) { $data['php_model'] = base64_encode($data['php_model']); } // Set the php_ajaxmethod string to base64 string. if (isset($data['php_ajaxmethod'])) { $data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']); } // Set the html_import_view string to base64 string. if (isset($data['html_import_view'])) { $data['html_import_view'] = base64_encode($data['html_import_view']); } // Set the php_import_save string to base64 string. if (isset($data['php_import_save'])) { $data['php_import_save'] = base64_encode($data['php_import_save']); } // Set the php_getitem string to base64 string. if (isset($data['php_getitem'])) { $data['php_getitem'] = base64_encode($data['php_getitem']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Method to get header. * * @return mixed An array of data items on success, false on failure. */ public function getExImPortHeaders() { // Get a db connection. $db = JFactory::getDbo(); // get the columns $columns = $db->getTableColumns("#__componentbuilder_component"); if (ComponentbuilderHelper::checkArray($columns)) { // remove the headers you don't import/export. unset($columns['asset_id']); unset($columns['checked_out']); unset($columns['checked_out_time']); $headers = new stdClass(); foreach ($columns as $column => $type) { $headers->{$column} = $column; } return $headers; } return false; }
/** * Setting the toolbar */ protected function addToolBar() { JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENTS'), 'support'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=help_documents'); JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { JToolBarHelper::addNew('help_document.add'); } // Only load if there are items if (ComponentbuilderHelper::checkArray($this->items)) { if ($this->canEdit) { JToolBarHelper::editList('help_document.edit'); } if ($this->canState) { JToolBarHelper::publishList('help_documents.publish'); JToolBarHelper::unpublishList('help_documents.unpublish'); JToolBarHelper::archiveList('help_documents.archive'); if ($this->canDo->get('core.admin')) { JToolBarHelper::checkin('help_documents.checkin'); } } // Add a batch button if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); // set the batch button name $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { JToolbarHelper::trash('help_documents.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export')) { JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import')) { JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false); } // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('help_documents'); if (ComponentbuilderHelper::checkString($help_url)) { JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); } if ($this->canState) { JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)); // only load if batch allowed if ($this->canBatch) { JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)); } } JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')); } // Set Type Selection $this->typeOptions = $this->getTheTypeSelections(); if ($this->typeOptions) { // Type Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL') . ' -', 'filter_type', JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Type Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_TYPE_LABEL') . ' -', 'batch[type]', JHtml::_('select.options', $this->typeOptions, 'value', 'text')); } } // Set Location Selection $this->locationOptions = $this->getTheLocationSelections(); if ($this->locationOptions) { // Location Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL') . ' -', 'filter_location', JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Location Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_LOCATION_LABEL') . ' -', 'batch[location]', JHtml::_('select.options', $this->locationOptions, 'value', 'text')); } } // Set Admin View Selection $this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->getOptions(); if ($this->admin_viewOptions) { // Admin View Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'filter_admin_view', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Admin View Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_ADMIN_VIEW_LABEL') . ' -', 'batch[admin_view]', JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text')); } } // Set Site View Selection $this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->getOptions(); if ($this->site_viewOptions) { // Site View Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL') . ' -', 'filter_site_view', JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Site View Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_HELP_DOCUMENT_SITE_VIEW_LABEL') . ' -', 'batch[site_view]', JHtml::_('select.options', $this->site_viewOptions, 'value', 'text')); } } }
public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single) { // make sure it is not already been build if (!isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']])) { // first build the custom field type file $target = array('admin' => 'customfield'); $this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']); // set tab and break replacements $tabBreak = array('\\t' => "\t", '\\n' => "\n"); // make field dynamic $replace = array('###TABLE###' => $data['custom']['table'], '###ID###' => $data['custom']['id'], '###TEXT###' => $data['custom']['text'], '###CODE_TEXT###' => $data['code'] . '_' . $data['custom']['text'], '###CODE###' => $data['code'], '###component###' => $this->fileContentStatic['###component###'], '###Component###' => $this->fileContentStatic['###Component###'], '###view_type###' => $viewName_single . '_' . $data['type'], '###type###' => $data['type'], '###view###' => $viewName_single, '###views###' => $viewName_list); // now load the php script if (isset($data['custom']['php']) && ComponentbuilderHelper::checkArray($data['custom']['php'])) { // make sure the ar is reset $phpCode = ''; foreach ($data['custom']['php'] as $line => $code) { if (ComponentbuilderHelper::checkString($code)) { if ($line == 1) { $phpCode .= str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } else { $phpCode .= "\n\t\t" . str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } } } // replace the placholders $phpCode = str_replace(array_keys($replace), array_values($replace), $phpCode); } else { $phpCode = 'return null;'; } if (!ComponentbuilderHelper::checkString($phpCode)) { $phpCode = 'return null;'; } if ($data['custom']['extends'] == 'user') { // now load the php xclude script if (ComponentbuilderHelper::checkArray($data['custom']['phpx'])) { // make sure the ar is reset $phpxCode = ''; foreach ($data['custom']['phpx'] as $line => $code) { if (ComponentbuilderHelper::checkString($code)) { if ($line == 1) { $phpxCode .= str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } else { $phpxCode .= "\n\t\t" . str_replace(array_keys($tabBreak), array_values($tabBreak), $code); } } } // replace the placholders $phpxCode = str_replace(array_keys($replace), array_values($replace), $phpxCode); } else { $phpxCode = 'return null;'; } if (!ComponentbuilderHelper::checkString($phpxCode)) { $phpxCode = 'return null;'; } // temp holder for name $tempName = $data['custom']['label'] . ' Group'; // set lang $groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U'); // add to lang array $this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W'); // build the Group Control $this->setGroupControl[$data['type']] = $groupLangName; // ###JFORM_GETGROUPS_PHP### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode; // ###JFORM_GETEXCLUDED_PHP### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode; } else { // ###JFORM_GETOPTIONS_PHP### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode; } // ###Type### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F'); // ###type### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###type###'] = $data['custom']['type']; // ###type### <<<DYNAMIC>>> $this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'], $data['custom']['views']); } }
/** * Escape the values for a SQL dump * * @param string $value the value to escape * * @return string on success with escaped string * */ public function mysql_escape($value) { // if array then return maped if (ComponentbuilderHelper::checkArray($value)) { return array_map(__METHOD__, $value); } // if string make sure it is correctly escaped if (ComponentbuilderHelper::checkString($value) && !is_numeric($value)) { // Get a db connection. $db = JFactory::getDbo(); return $db->quote($value); } // if empty value return place holder if (empty($value)) { return "''"; } // if not array or string then return number return $value; }
public function buildPermissions(&$view, $nameView, $nameViews, $menuControllers, $type = 'admin') { if (isset($view['settings']->permissions) && ComponentbuilderHelper::checkArray($view['settings']->permissions) || isset($view['port']) && $view['port'] || isset($view['history']) && $view['history']) { // add export/import permissions to each view that has export/import options if (isset($view['port']) && $view['port']) { // export $exportView['action'] = 'view.export'; $exportView['implementation'] = '2'; if (ComponentbuilderHelper::checkArray($view['settings']->permissions)) { array_push($view['settings']->permissions, $exportView); } else { $view['settings']->permissions = array(); $view['settings']->permissions[] = $exportView; } // import $importView['action'] = 'view.import'; $importView['implementation'] = '2'; if (ComponentbuilderHelper::checkArray($view['settings']->permissions)) { array_push($view['settings']->permissions, $importView); } else { $view['settings']->permissions = array(); $view['settings']->permissions[] = $importView; } } // add version opstions to each view that has it added if (isset($view['history']) && $view['history']) { // set version control $versionView['action'] = 'view.version'; $versionView['implementation'] = '3'; if (ComponentbuilderHelper::checkArray($view['settings']->permissions)) { array_push($view['settings']->permissions, $versionView); } else { $view['settings']->permissions = array(); $view['settings']->permissions[] = $versionView; } } if ($type == 'admin') { // set batch control $batchView['action'] = 'view.batch'; $batchView['implementation'] = '2'; if (ComponentbuilderHelper::checkArray($view['settings']->permissions)) { array_push($view['settings']->permissions, $batchView); } else { $view['settings']->permissions = array(); $view['settings']->permissions[] = $batchView; } } foreach ($view['settings']->permissions as $permission) { // set acction name $arr = explode('.', trim($permission['action'])); if ($arr[0] != 'core' || $arr[0] == 'view') { array_shift($arr); $actionMain = implode('.', $arr); $action = $nameView . '.' . $actionMain; } else { if ($arr[0] == 'core') { // core is already set in global access $permission['implementation'] = 1; } $action = $permission['action']; } // build action name $actionNameBuilder = explode('.', trim($permission['action'])); array_shift($actionNameBuilder); $nameBuilder = trim(implode('___', $actionNameBuilder)); $customName = trim(implode(' ', $actionNameBuilder)); if ($type == 'admin') { $W_NameList = ComponentbuilderHelper::safeString($view['settings']->name_list, 'W'); $w_NameList = ComponentbuilderHelper::safeString($customName . ' ' . $view['settings']->name_list, 'w'); $w_NameSingle = ComponentbuilderHelper::safeString($view['settings']->name_single, 'w'); } elseif ($type == 'customAdmin') { $W_NameList = ComponentbuilderHelper::safeString($view['settings']->name, 'W'); $w_NameList = $view['settings']->name; $w_NameSingle = $view['settings']->name; } switch ($nameBuilder) { case 'edit': // set edit title $permission['title'] = $W_NameList . ' Edit'; // set edit description $permission['description'] = ' Allows the users in this group to edit the ' . $w_NameSingle; break; case 'edit___own': // set edit title $permission['title'] = $W_NameList . ' Edit Own'; // set edit description $permission['description'] = ' Allows the users in this group to edit ' . $w_NameList . ' created by them'; break; case 'edit___state': // set edit title $permission['title'] = $W_NameList . ' Edit State'; // set edit description $permission['description'] = ' Allows the users in this group to update the state of the ' . $w_NameSingle; break; case 'edit___created_by': // set edit title $permission['title'] = $W_NameList . ' Edit Created By'; // set edit description $permission['description'] = ' Allows the users in this group to update the created by of the ' . $w_NameList; break; case 'edit___created': // set edit title $permission['title'] = $W_NameList . ' Edit Created Date'; // set edit description $permission['description'] = ' Allows the users in this group to update the created date of the ' . $w_NameList; break; case 'create': // set edit title $permission['title'] = $W_NameList . ' Create'; // set edit description $permission['description'] = ' Allows the users in this group to create ' . $w_NameList; break; case 'delete': // set edit title $permission['title'] = $W_NameList . ' Delete'; // set edit description $permission['description'] = ' Allows the users in this group to delete ' . $w_NameList; break; case 'access': // set edit title $permission['title'] = $W_NameList . ' Access'; // set edit description $permission['description'] = ' Allows the users in this group to access ' . $w_NameList; break; case 'export': // set edit title $permission['title'] = $W_NameList . ' Export'; // set edit description $permission['description'] = ' Allows the users in this group to export ' . $w_NameList; break; case 'import': // set edit title $permission['title'] = $W_NameList . ' Import'; // set edit description $permission['description'] = ' Allows the users in this group to import ' . $w_NameList; break; case 'version': // set edit title $permission['title'] = $W_NameList . ' Edit Version'; // set edit description $permission['description'] = ' Allows users in this group to edit versions of ' . $w_NameList; break; case 'batch': // set edit title $permission['title'] = $W_NameList . ' Batch Use'; // set edit description $permission['description'] = ' Allows users in this group to use batch copy/update method of ' . $w_NameList; break; default: // set edit title $permission['title'] = $W_NameList . ' ' . ComponentbuilderHelper::safeString($customName, 'W'); // set edit description $permission['description'] = ' Allows the users in this group to update the ' . ComponentbuilderHelper::safeString($customName, 'w') . ' of the ' . $w_NameSingle; break; } // if core is not used update all core strings $coreCheck = explode('.', $action); $coreCheck[0] = 'core'; $coreTarget = implode('.', $coreCheck); $this->permissionCore[$nameView][$coreTarget] = $action; // set array sort name $sortKey = ComponentbuilderHelper::safeString($permission['title']); // set title $title = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($permission['title'], 'U'); // load the actions if ($permission['implementation'] == 1) { // only related to view $this->permissionViews[$nameView][] = '<action name="' . $action . '" title="' . $title . '" description="' . $title . '_DESC" />'; // load permission to action $this->permissionBuilder[$action][$nameView] = $nameView; } elseif ($permission['implementation'] == 2) { // relation to whole component $this->componentGlobal[$sortKey] = "\t\t" . '<action name="' . $action . '" title="' . $title . '" description="' . $title . '_DESC" />'; // build permission switch $this->permissionBuilder['global'][$action][$nameView] = $nameView; // dashboard icon checker if ($coreTarget == 'core.access') { $this->permissionDashboard[] = "'" . $nameViews . ".access' => '" . $action . "'"; $this->permissionDashboard[] = "'" . $nameView . ".access' => '" . $action . "'"; } if ($coreTarget == 'core.create') { $this->permissionDashboard[] = "'" . $nameView . ".create' => '" . $action . "'"; } // add menu controll view that has menus options foreach ($menuControllers as $menuController) { if ($coreTarget == 'core.' . $menuController) { if ($menuController == 'dashboard_add') { $this->permissionDashboard[] = "'" . $nameView . "." . $menuController . "' => '" . $action . "'"; } else { $this->permissionDashboard[] = "'" . $nameViews . "." . $menuController . "' => '" . $action . "'"; } } } } elseif ($permission['implementation'] == 3) { // only related to view $this->permissionViews[$nameView][] = '<action name="' . $action . '" title="' . $title . '" description="' . $title . '_DESC" />'; // load permission to action $this->permissionBuilder[$action][$nameView] = $nameView; // relation to whole component $this->componentGlobal[$sortKey] = "\t\t" . '<action name="' . $action . '" title="' . $title . '" description="' . $title . '_DESC" />'; // build permission switch $this->permissionBuilder['global'][$action][$nameView] = $nameView; // dashboard icon checker if ($coreTarget == 'core.access') { $this->permissionDashboard[] = "'" . $nameViews . ".access' => '" . $action . "'"; $this->permissionDashboard[] = "'" . $nameView . ".access' => '" . $action . "'"; } if ($coreTarget == 'core.create') { $this->permissionDashboard[] = "'" . $nameView . ".create' => '" . $action . "'"; } // add menu controll view that has menus options foreach ($menuControllers as $menuController) { if ($coreTarget == 'core.' . $menuController) { if ($menuController == 'dashboard_add') { $this->permissionDashboard[] = "'" . $nameView . "." . $menuController . "' => '" . $action . "'"; } else { $this->permissionDashboard[] = "'" . $nameViews . "." . $menuController . "' => '" . $action . "'"; } } } } // set to language file $this->langContent['admin'][$title] = trim($permission['title']); $this->langContent['admin'][$title . '_DESC'] = trim($permission['description']); } } }
/** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; $filter = JFilterInput::getInstance(); // set the metadata to the Item Data if (isset($data['metadata']) && isset($data['metadata']['author'])) { $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $metadata = new JRegistry(); $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; } // Set the php_after_getitem string to base64 string. if (isset($data['php_after_getitem'])) { $data['php_after_getitem'] = base64_encode($data['php_after_getitem']); } // Set the php_before_getitems string to base64 string. if (isset($data['php_before_getitems'])) { $data['php_before_getitems'] = base64_encode($data['php_before_getitems']); } // Set the php_before_getitem string to base64 string. if (isset($data['php_before_getitem'])) { $data['php_before_getitem'] = base64_encode($data['php_before_getitem']); } // Set the php_getlistquery string to base64 string. if (isset($data['php_getlistquery'])) { $data['php_getlistquery'] = base64_encode($data['php_getlistquery']); } // Set the php_after_getitems string to base64 string. if (isset($data['php_after_getitems'])) { $data['php_after_getitems'] = base64_encode($data['php_after_getitems']); } // Set the php_calculation string to base64 string. if (isset($data['php_calculation'])) { $data['php_calculation'] = base64_encode($data['php_calculation']); } // Set the php_custom_get string to base64 string. if (isset($data['php_custom_get'])) { $data['php_custom_get'] = base64_encode($data['php_custom_get']); } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) { $params = new JRegistry(); $params->loadArray($data['params']); $data['params'] = (string) $params; } // Alter the uniqe field for save as copy if ($input->get('task') == 'save2copy') { // Automatic handling of other uniqe fields $uniqeFields = $this->getUniqeFields(); if (ComponentbuilderHelper::checkArray($uniqeFields)) { foreach ($uniqeFields as $uniqeField) { $data[$uniqeField] = $this->generateUniqe($uniqeField, $data[$uniqeField]); } } } if (parent::save($data)) { return true; } return false; }
/** * Setting the toolbar */ protected function addToolBar() { JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_SITE_VIEWS'), 'stack'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=site_views'); JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { JToolBarHelper::addNew('site_view.add'); } // Only load if there are items if (ComponentbuilderHelper::checkArray($this->items)) { if ($this->canEdit) { JToolBarHelper::editList('site_view.edit'); } if ($this->canState) { JToolBarHelper::publishList('site_views.publish'); JToolBarHelper::unpublishList('site_views.unpublish'); JToolBarHelper::archiveList('site_views.archive'); if ($this->canDo->get('core.admin')) { JToolBarHelper::checkin('site_views.checkin'); } } // Add a batch button if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); // set the batch button name $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { JToolbarHelper::deleteList('', 'site_views.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { JToolbarHelper::trash('site_views.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('site_view.export')) { JToolBarHelper::custom('site_views.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('site_view.import')) { JToolBarHelper::custom('site_views.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false); } // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('site_views'); if (ComponentbuilderHelper::checkString($help_url)) { JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); } if ($this->canState) { JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)); // only load if batch allowed if ($this->canBatch) { JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)); } } JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')); } }
/** * Setting the toolbar */ protected function addToolBar() { JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_FIELDS'), 'lamp'); JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=fields'); JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); if ($this->canCreate) { JToolBarHelper::addNew('field.add'); } // Only load if there are items if (ComponentbuilderHelper::checkArray($this->items)) { if ($this->canEdit) { JToolBarHelper::editList('field.edit'); } if ($this->canState) { JToolBarHelper::publishList('fields.publish'); JToolBarHelper::unpublishList('fields.unpublish'); JToolBarHelper::archiveList('fields.archive'); if ($this->canDo->get('core.admin')) { JToolBarHelper::checkin('fields.checkin'); } } // Add a batch button if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) { // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); // set the batch button name $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { JToolbarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($this->canState && $this->canDelete) { JToolbarHelper::trash('fields.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('field.export')) { JToolBarHelper::custom('fields.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } if ($this->canDo->get('core.import') && $this->canDo->get('field.import')) { JToolBarHelper::custom('fields.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false); } // set help url for this view if found $help_url = ComponentbuilderHelper::getHelpUrl('fields'); if (ComponentbuilderHelper::checkString($help_url)) { JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); } // add the options comp button if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) { JToolBarHelper::preferences('com_componentbuilder'); } if ($this->canState) { JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)); // only load if batch allowed if ($this->canBatch) { JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)); } } JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')); } // Category Filter. JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fields'), 'value', 'text', $this->state->get('filter.category_id'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Category Batch selection. JHtmlBatch_::addListSelection(JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_CATEGORY'), 'batch[category]', JHtml::_('select.options', JHtml::_('category.options', 'com_componentbuilder.fields'), 'value', 'text')); } // Set Fieldtype Name Selection $this->fieldtypeNameOptions = JFormHelper::loadFieldType('Fieldtypes')->getOptions(); if ($this->fieldtypeNameOptions) { // Fieldtype Name Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL') . ' -', 'filter_fieldtype', JHtml::_('select.options', $this->fieldtypeNameOptions, 'value', 'text', $this->state->get('filter.fieldtype'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Fieldtype Name Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_FIELD_FIELDTYPE_LABEL') . ' -', 'batch[fieldtype]', JHtml::_('select.options', $this->fieldtypeNameOptions, 'value', 'text')); } } // Set Datatype Selection $this->datatypeOptions = $this->getTheDatatypeSelections(); if ($this->datatypeOptions) { // Datatype Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL') . ' -', 'filter_datatype', JHtml::_('select.options', $this->datatypeOptions, 'value', 'text', $this->state->get('filter.datatype'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Datatype Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL') . ' -', 'batch[datatype]', JHtml::_('select.options', $this->datatypeOptions, 'value', 'text')); } } // Set Indexes Selection $this->indexesOptions = $this->getTheIndexesSelections(); if ($this->indexesOptions) { // Indexes Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL') . ' -', 'filter_indexes', JHtml::_('select.options', $this->indexesOptions, 'value', 'text', $this->state->get('filter.indexes'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Indexes Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL') . ' -', 'batch[indexes]', JHtml::_('select.options', $this->indexesOptions, 'value', 'text')); } } // Set Null Switch Selection $this->null_switchOptions = $this->getTheNull_switchSelections(); if ($this->null_switchOptions) { // Null Switch Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL') . ' -', 'filter_null_switch', JHtml::_('select.options', $this->null_switchOptions, 'value', 'text', $this->state->get('filter.null_switch'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Null Switch Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL') . ' -', 'batch[null_switch]', JHtml::_('select.options', $this->null_switchOptions, 'value', 'text')); } } // Set Store Selection $this->storeOptions = $this->getTheStoreSelections(); if ($this->storeOptions) { // Store Filter JHtmlSidebar::addFilter('- Select ' . JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL') . ' -', 'filter_store', JHtml::_('select.options', $this->storeOptions, 'value', 'text', $this->state->get('filter.store'))); if ($this->canBatch && $this->canCreate && $this->canEdit) { // Store Batch Selection JHtmlBatch_::addListSelection('- Keep Original ' . JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL') . ' -', 'batch[store]', JHtml::_('select.options', $this->storeOptions, 'value', 'text')); } } }