当前位置: 首页>>代码示例>>PHP>>正文


PHP CostbenefitprojectionHelper::getActions方法代码示例

本文整理汇总了PHP中CostbenefitprojectionHelper::getActions方法的典型用法代码示例。如果您正苦于以下问题:PHP CostbenefitprojectionHelper::getActions方法的具体用法?PHP CostbenefitprojectionHelper::getActions怎么用?PHP CostbenefitprojectionHelper::getActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CostbenefitprojectionHelper的用法示例。


在下文中一共展示了CostbenefitprojectionHelper::getActions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 /**
  * 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();
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:37,代码来源:view.html.php

示例2: addToolBar

 /**
  * 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');
     }
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:16,代码来源:view.html.php

示例3: Zusammenarbeit

	@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');
        }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:31,代码来源:default_body.php

示例4: foreach

		</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;
            ?>
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:31,代码来源:service_providers_fullwidth.php

示例5: foreach

		</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;
            ?>
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:31,代码来源:companies_fullwidth.php

示例6: save

 /**
  * 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);
//.........这里部分代码省略.........
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:101,代码来源:import.php

示例7: Zusammenarbeit

	@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>';
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:31,代码来源:companydetails.php

示例8: batchMove

 /**
  * 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;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:98,代码来源:country.php

示例9: setInterventionLink

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;
}
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:21,代码来源:default.php


注:本文中的CostbenefitprojectionHelper::getActions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。