/** * display method of View * @return void */ public function display($tpl = null) { // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->script = $this->get('Script'); $this->state = $this->get('State'); // get action permissions $this->canDo = CostbenefitprojectionHelper::getActions('help_document', $this->item); // get input $jinput = JFactory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); $this->referral = ''; if ($this->refid) { // return to the item that refered to this item $this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid; } elseif ($this->ref) { // return to the list view that refered to this item $this->referral = '&ref=' . (string) $this->ref; } // Set the toolbar $this->addToolBar(); // Display the template parent::display($tpl); // Set the document $this->setDocument(); }
public function display($tpl = null) { if ($this->getLayout() !== 'modal') { // Include helper submenu CostbenefitprojectionHelper::addSubmenu('import'); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $paths = new stdClass(); $paths->first = ''; $state = $this->get('state'); $this->paths =& $paths; $this->state =& $state; // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('import'); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); } // get the session object $session = JFactory::getSession(); // check if it has package $this->hasPackage = $session->get('hasPackage', false); $this->dataType = $session->get('dataType', false); if ($this->hasPackage && $this->dataType) { $this->headerList = json_decode($session->get($this->dataType . '_VDM_IMPORTHEADERS', false), true); $this->headerListAdv = array("location_name" => JText::_('COM_COSTBENEFITPROJECTION_LOCATION_NAME'), "year" => JText::_('COM_COSTBENEFITPROJECTION_YEAR'), "cause" => JText::_('COM_COSTBENEFITPROJECTION_CAUSE_ID'), "cause_name" => JText::_('COM_COSTBENEFITPROJECTION_CAUSE_NAME'), "risk" => JText::_('COM_COSTBENEFITPROJECTION_RISK_ID'), "risk_name" => JText::_('COM_COSTBENEFITPROJECTION_RISK_NAME'), "age" => JText::_('COM_COSTBENEFITPROJECTION_AGE_ID'), "age_name" => JText::_('COM_COSTBENEFITPROJECTION_AGE_NAME'), "sex" => JText::_('COM_COSTBENEFITPROJECTION_GENDER_ID'), "sex_name" => JText::_('COM_COSTBENEFITPROJECTION_GENDER_NAME'), "rt_mean" => JText::_('COM_COSTBENEFITPROJECTION_RT_MEAN_VALUE'), "metric" => JText::_('COM_COSTBENEFITPROJECTION_METRIC'), "metric_name" => JText::_('COM_COSTBENEFITPROJECTION_METRIC_NAME')); // make sure these files are loaded JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); $package = $session->get('package', null); $package = json_decode($package, true); $inputFileType = PHPExcel_IOFactory::identify($package['dir']); if ('csv' == trim(strtolower($inputFileType), '.')) { $this->headers = CostbenefitprojectionHelper::getFileHeadersCSV($package['dir']); } else { $this->headers = CostbenefitprojectionHelper::getFileHeaders($this->dataType); } // set active tab if (in_array('rt_mean', $this->headers) || in_array('metric', $this->headers)) { $this->activeTab = 'advanced'; } else { $this->activeTab = 'basic'; } // clear the data type $session->clear('dataType'); } // Display the template parent::display($tpl); }
/** * Setting the toolbar */ protected function addToolBar() { $canDo = CostbenefitprojectionHelper::getActions('costbenefitprojection'); JToolBarHelper::title(JText::_('COM_COSTBENEFITPROJECTION_DASHBOARD'), 'grid-2'); // set help url for this view if found $help_url = CostbenefitprojectionHelper::getHelpUrl('costbenefitprojection'); if (CostbenefitprojectionHelper::checkString($help_url)) { JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolBarHelper::preferences('com_costbenefitprojection'); } }
function display($tpl = null) { // get component params $this->params = JComponentHelper::getParams('com_costbenefitprojection'); // get the application $this->app = JFactory::getApplication(); // get the user object $this->user = JFactory::getUser(); // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('combinedresults'); // Initialise variables. $this->items = $this->get('Items'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // check if the data was returned if ($this->items) { // combine the results $this->results = CostbenefitprojectionHelper::combine($this->items); // set the companies names $this->names = $this->results->companiesNames; $this->item = new stdClass(); $this->item->currency_name = $this->results->currencyDetails->currency_name; // set the tab details $this->chart_tabs = $this->getChartTabs(); $this->table_tabs = $this->getTableTabs(); } else { // int all as false $this->results = false; // set the companies names $this->names = JText::_('COM_COSTBENEFITPROJECTION_NONE_LOADED'); $this->item = new stdClass(); $this->item->currency_name = ''; // set the tab details $this->chart_tabs = false; $this->table_tabs = false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { // add the tool bar $this->addToolBar(); } // set the document $this->setDocument(); parent::display($tpl); }
function display($tpl = null) { // get component params $this->params = JComponentHelper::getParams('com_costbenefitprojection'); // get the application $this->app = JFactory::getApplication(); // get the user object $this->user = JFactory::getUser(); // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('companyresults'); // Initialise variables. $this->item = $this->get('Item'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // check if the data was returned if ($this->item) { // get results $data = base64_encode(serialize($this->item)); $this->results = CostbenefitprojectionHelper::calculate($this->item->id, $data); // set the tab details $this->chart_tabs = $this->getChartTabs(); $this->table_tabs = $this->getTableTabs(); } else { // int all as false $this->results = false; // set the tab details $this->chart_tabs = false; $this->table_tabs = false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { // add the tool bar $this->addToolBar(); } // set the document $this->setDocument(); parent::display($tpl); }
/** * Currencies view display method * @return void */ function display($tpl = null) { if ($this->getLayout() !== 'modal') { // Include helper submenu CostbenefitprojectionHelper::addSubmenu('currencies'); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Assign data to the view $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->user = JFactory::getUser(); $this->listOrder = $this->escape($this->state->get('list.ordering')); $this->listDirn = $this->escape($this->state->get('list.direction')); $this->saveOrder = $this->listOrder == 'ordering'; // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('currency'); $this->canEdit = $this->canDo->get('currency.edit'); $this->canState = $this->canDo->get('currency.edit.state'); $this->canCreate = $this->canDo->get('currency.create'); $this->canDelete = $this->canDo->get('currency.delete'); $this->canBatch = $this->canDo->get('core.batch'); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); // load the batch html if ($this->canCreate && $this->canEdit && $this->canState) { $this->batchDisplay = JHtmlBatch_::render(); } } // Display the template parent::display($tpl); // Set the document $this->setDocument(); }
public function display($tpl = null) { if ($this->getLayout() !== 'modal') { // Include helper submenu CostbenefitprojectionHelper::addSubmenu('import'); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $paths = new stdClass(); $paths->first = ''; $state = $this->get('state'); $this->paths =& $paths; $this->state =& $state; // get global action permissions $this->canDo = CostbenefitprojectionHelper::getActions('import'); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); } // get the session object $session = JFactory::getSession(); // check if it has package $this->hasPackage = $session->get('hasPackage', false); $this->dataType = $session->get('dataType', false); if ($this->hasPackage && $this->dataType) { $this->headerList = json_decode($session->get($this->dataType . '_VDM_IMPORTHEADERS', false), true); $this->headers = CostbenefitprojectionHelper::getFileHeaders($this->dataType); // clear the data type $session->clear('dataType'); } // Display the template parent::display($tpl); }
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=help_documents&task=help_document.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('help_document', $item, 'help_documents'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('help_document.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
</th> <th width="5" data-type="numeric" data-hide="phone,tablet"> <?php echo JText::_('COM_COSTBENEFITPROJECTION_SERVICE_PROVIDER_ID'); ?> </th> </tr> </thead> <tbody> <?php foreach ($items as $i => $item) { ?> <?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('service_provider', $item, 'service_providers'); ?> <tr> <td class="nowrap"> <?php if ($canDo->get('service_provider.edit')) { ?> <a href="<?php echo $edit; ?> &id=<?php echo $item->id; ?> &ref=country&refid=<?php echo $id; ?>
</th> <th width="5" data-type="numeric" data-hide="phone,tablet"> <?php echo JText::_('COM_COSTBENEFITPROJECTION_COMPANY_ID'); ?> </th> </tr> </thead> <tbody> <?php foreach ($items as $i => $item) { ?> <?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('company', $item, 'companies'); ?> <tr> <td class="nowrap"> <?php if ($canDo->get('company.edit')) { ?> <a href="<?php echo $edit; ?> &id=<?php echo $item->id; ?> &ref=service_provider&refid=<?php echo $id; ?>
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=currencies&task=currency.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('currency', $item, 'currencies'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('currency.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
/** * 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 (CostbenefitprojectionHelper::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 (CostbenefitprojectionHelper::checkArray($data['array']) && $user->authorise($table . '.import', 'com_costbenefitprojection') && $user->authorise('core.import', 'com_costbenefitprojection')) { // 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 = CostbenefitprojectionHelper::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('#__costbenefitprojection_' . $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('#__costbenefitprojection_' . $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('#__costbenefitprojection_' . $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 CostbenefitprojectionHelper::setAsset($aId, $table); } } else { return false; } } return true; } } return false; }
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=scaling_factors&task=scaling_factor.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('scaling_factor', $item, 'scaling_factors'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('scaling_factor.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=health_data_sets&task=health_data.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('health_data', $item, 'health_data_sets'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('health_data.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=causesrisks&task=causerisk.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('causerisk', $item, 'causesrisks'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('causerisk.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
@subpackage companydetails.php @author Llewellyn van der Merwe <http://www.vdm.io> @owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('JPATH_BASE') or die('Restricted access'); // set som user permissions $user = JFactory::getUser(); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $displayData->checked_out == $user->id || $displayData->checked_out == 0; $userChkOut = JFactory::getUser($displayData->checked_out); $canDo = CostbenefitprojectionHelper::getActions('company', $displayData, 'companies'); // setup the cause risk list $causesrisks = '<div class="uk-alert">' . JText::_('COM_COSTBENEFITPROJECTION_NO_CAUSERISK_SELECTED') . '</div>'; if (isset($displayData->causesrisks) && CostbenefitprojectionHelper::checkArray($displayData->causesrisks)) { $causesrisks = ''; $body = ''; $keys = array('name' => JText::_('COM_COSTBENEFITPROJECTION_NAME'), 'description' => JText::_('COM_COSTBENEFITPROJECTION_DESCRIPTION'), 'ref' => JText::_('REF'), 'importname' => JText::_('COM_COSTBENEFITPROJECTION_FULL_NAME')); $getValues = array('name', 'description', 'ref', 'importname'); // header switces $dataSwitch = array('name' => ' data-toggle="true"', 'description' => ' data-hide="phone"', 'ref' => ' data-hide="phone,tablet"', 'importname' => ' data-hide="all"'); foreach ($displayData->causesrisks as $id) { // get cause risk details $details = CostbenefitprojectionHelper::getCauseRiskDetails($id, $getValues); if (CostbenefitprojectionHelper::checkObject($details)) { // build the dl list $row = '<tr>';
/** * Batch move items to a new category * * @param integer $value The new category ID. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 12.2 */ protected function batchMove($values, $pks, $contexts) { if (empty($this->batchSet)) { // Set some needed variables. $this->user = JFactory::getUser(); $this->table = $this->getTable(); $this->tableClassName = get_class($this->table); $this->contentType = new JUcmType(); $this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->canDo = CostbenefitprojectionHelper::getActions('country'); } if (!$this->canDo->get('country.edit') && !$this->canDo->get('country.batch')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } if (!$this->user->authorise('core.options', 'com_costbenefitprojection')) { // make absolutely sure that this country can be moved $is = CostbenefitprojectionHelper::userIs($user->id); $countries = CostbenefitprojectionHelper::hisCountries($this->user->id); if (3 == $is && CostbenefitprojectionHelper::checkArray($countries)) { foreach ($pks as $nr => $pk) { if (!in_array($pk, $countries)) { unset($pks[$nr]); } } if (empty($pks)) { $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', 0)); return false; } } else { $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', 0)); return false; } } // make sure published only updates if user has the permission. if (isset($values['published']) && !$this->canDo->get('country.edit.state')) { unset($values['published']); } // remove move_copy from array unset($values['move_copy']); // Parent exists so we proceed foreach ($pks as $pk) { if (!$this->user->authorise('country.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // Check that the row actually exists if (!$this->table->load($pk)) { if ($error = $this->table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // insert all set values. if (CostbenefitprojectionHelper::checkArray($values)) { foreach ($values as $key => $value) { // Do special action for access. if ('access' == $key && strlen($value) > 0) { $this->table->{$key} = $value; } elseif (strlen($value) > 0 && isset($this->table->{$key})) { $this->table->{$key} = $value; } } } // Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); return false; } if (!empty($this->type)) { $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); } // Store the row. if (!$this->table->store()) { $this->setError($this->table->getError()); return false; } } // Clean the cache $this->cleanCache(); return true; }
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=interventions&task=intervention.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('intervention', $item, 'interventions'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('intervention.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb @copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html /-------------------------------------------------------------------------------------------------------/ Cost Benefit Projection Tool. /------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $edit = "index.php?option=com_costbenefitprojection&view=countries&task=country.edit"; foreach ($this->items as $i => $item) { ?> <?php $canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('country', $item, 'countries'); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="order nowrap center hidden-phone"> <?php if ($canDo->get('country.edit.state')) { ?> <?php if ($this->saveOrder) { $iconClass = ' inactive'; } else { $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); }
function setInterventionLink($item) { $user = JFactory::getUser(); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; $userChkOut = JFactory::getUser($item->checked_out); $canDo = CostbenefitprojectionHelper::getActions('intervention', $item, 'interventions'); if ($canDo->get('intervention.edit')) { if ($item->checked_out && $canCheckin) { $link = '<td><a href="' . JRoute::_('index.php?option=com_costbenefitprojection&view=intervention&task=intervention.edit&id=' . $item->id) . '" >' . $item->name . '</a>'; $link .= JHtml::_('jgrid.checkedout', $item->id, $userChkOut->name, $item->checked_out_time, 'interventions.', $canCheckin) . '</td>'; } elseif ($item->checked_out && !$canCheckin) { $link = '<td>' . $item->name; $link .= JHtml::_('jgrid.checkedout', $item->id, $userChkOut->name, $item->checked_out_time, 'interventions.', $canCheckin) . '</td>'; } else { $link = '<td><a href="' . JRoute::_('index.php?option=com_costbenefitprojection&view=intervention&task=intervention.edit&id=' . $item->id) . '" >' . $item->name . '</a></td>'; } } else { $link = '<td>' . $item->name . '</td>'; } return $link; }