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


PHP CostbenefitprojectionHelper类代码示例

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


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

示例1: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 public function getOptions()
 {
     // Get the user object.
     $user = JFactory::getUser();
     // Create a new query object.
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select($db->quoteName(array('a.id', 'a.name'), array('id', 'testcompanies_name')));
     $query->from($db->quoteName('#__costbenefitprojection_company', 'a'));
     $query->where($db->quoteName('a.published') . ' = 1');
     if (!$user->authorise('core.options', 'com_costbenefitprojection')) {
         $companies = CostbenefitprojectionHelper::hisCompanies($user->id);
         if (CostbenefitprojectionHelper::checkArray($companies)) {
             $companies = implode(',', $companies);
             // only load this users companies
             $query->where('a.id IN (' . $companies . ')');
         } else {
             // dont allow user to see any companies
             $query->where('a.id = -4');
         }
     }
     $query->order('a.name ASC');
     $db->setQuery((string) $query);
     $items = $db->loadObjectList();
     $options = array();
     if ($items) {
         foreach ($items as $item) {
             $tmp = array('value' => $item->id, 'text' => '&nbsp;<strong>' . $item->testcompanies_name . '</strong>', 'checked' => false);
             $options[] = (object) $tmp;
         }
     }
     return $options;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:38,代码来源:companycheck.php

示例2: importData

 public function importData()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // check if import is allowed for this user.
     $user = JFactory::getUser();
     if ($user->authorise('help_document.import', 'com_costbenefitprojection') && $user->authorise('core.import', 'com_costbenefitprojection')) {
         // Get the import model
         $model = $this->getModel('Help_documents');
         // get the headers to import
         $headers = $model->getExImPortHeaders();
         if (CostbenefitprojectionHelper::checkObject($headers)) {
             // Load headers to session.
             $session = JFactory::getSession();
             $headers = json_encode($headers);
             $session->set('help_document_VDM_IMPORTHEADERS', $headers);
             $session->set('backto_VDM_IMPORT', 'help_documents');
             $session->set('dataType_VDM_IMPORTINTO', 'help_document');
             // Redirect to import view.
             $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS');
             $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=import', false), $message);
             return;
         }
     }
     // Redirect to the list screen with error.
     $message = JText::_('COM_COSTBENEFITPROJECTION_IMPORT_FAILED');
     $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=help_documents', false), $message, 'error');
     return;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:29,代码来源:help_documents.php

示例3: checkEditView

 protected function checkEditView($view)
 {
     if (CostbenefitprojectionHelper::checkString($view)) {
         $views = array('company', 'scaling_factor', 'intervention');
         // check if this is a edit view
         if (in_array($view, $views)) {
             return true;
         }
     }
     return false;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:11,代码来源:controller.php

示例4: 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

示例5: getViewRelation

 protected function getViewRelation($view)
 {
     if (CostbenefitprojectionHelper::checkString($view)) {
         $views = array('company' => 'companies', 'service_provider' => 'service_providers', 'country' => 'countries', 'causerisk' => 'causesrisks', 'health_data' => 'health_data_sets', 'scaling_factor' => 'scaling_factors', 'intervention' => 'interventions', 'currency' => 'currencies', 'help_document' => 'help_documents');
         // check if this is a list view
         if (in_array($view, $views)) {
             return array('edit' => false, 'view' => array_search($view, $views), 'views' => $view);
         } elseif (array_key_exists($view, $views)) {
             return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
         }
     }
     return false;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:13,代码来源:controller.php

示例6: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // get user object.
     $user = JFactory::getUser();
     // get record id.
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     if (!$user->authorise('core.options', 'com_costbenefitprojection')) {
         // make absolutely sure that this health data can be edited
         $is = CostbenefitprojectionHelper::userIs($user->id);
         $countries = CostbenefitprojectionHelper::hisCountries($user->id);
         $country = CostbenefitprojectionHelper::getId('health_data', $recordId, 'id', 'country');
         if (3 != $is || !CostbenefitprojectionHelper::checkArray($countries) || !in_array($country, $countries)) {
             return false;
         }
     }
     // Access check.
     $access = $user->authorise('health_data.access', 'com_costbenefitprojection.health_data.' . (int) $recordId) && $user->authorise('health_data.access', 'com_costbenefitprojection');
     if (!$access) {
         return false;
     }
     if ($recordId) {
         // The record has been set. Check the record permissions.
         $permission = $user->authorise('health_data.edit', 'com_costbenefitprojection.health_data.' . (int) $recordId);
         if (!$permission && !is_null($permission)) {
             if ($user->authorise('health_data.edit.own', 'com_costbenefitprojection.health_data.' . $recordId)) {
                 // Now test the owner is the user.
                 $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
                 if (empty($ownerId)) {
                     // Need to do a lookup from the model.
                     $record = $this->getModel()->getItem($recordId);
                     if (empty($record)) {
                         return false;
                     }
                     $ownerId = $record->created_by;
                 }
                 // If the owner matches 'me' then allow.
                 if ($ownerId == $user->id) {
                     if ($user->authorise('health_data.edit.own', 'com_costbenefitprojection')) {
                         return true;
                     }
                 }
             }
             return false;
         }
     }
     // Since there is no permission, revert to the component permissions.
     return $user->authorise('health_data.edit', $this->option);
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:58,代码来源:health_data.php

示例7: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 public function getOptions()
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select($db->quoteName(array('a.id', 'a.name', 'a.ref'), array('id', 'causesrisks_name', 'ref')));
     $query->from($db->quoteName('#__costbenefitprojection_causerisk', 'a'));
     $query->where($db->quoteName('a.published') . ' = 1');
     $query->order('a.ref ASC');
     $db->setQuery((string) $query);
     $items = $db->loadObjectList();
     $options = array();
     $counter = 0;
     if ($items) {
         foreach ($items as $item) {
             $ref = explode('.', $item->ref);
             $target_id = implode('-', $ref);
             $key = explode('.0', $item->ref);
             $key = implode('.', $key);
             $spacer = array();
             $sub = '';
             $sub_ = '';
             foreach ($ref as $nr => $space) {
                 if ($nr > 1) {
                     $spacer[] = '<span class=\'gi\'>|&mdash;</span>';
                 }
                 if ($nr > 2) {
                     $sub = '<em>';
                     $sub_ = '</em>';
                 }
             }
             if (CostbenefitprojectionHelper::checkArray($spacer)) {
                 $tmp = array('value' => $item->id, 'text' => '<span id=' . $target_id . ' style=\'color:' . $color . ';\'>&nbsp;&nbsp;' . implode('', $spacer) . '&nbsp;' . $sub . $item->causesrisks_name . $sub_ . '&nbsp;<small>(' . $key . ')</small></span>', 'checked' => false);
                 $options[] = (object) $tmp;
             } else {
                 if ($counter & 1) {
                     $color = '#0C5B00';
                 } else {
                     $color = '#1A3867';
                 }
                 $tmp = array('value' => $item->id, 'text' => '<span id=' . $target_id . ' style=\'color:' . $color . ';\'>&nbsp;&nbsp;<strong>' . strtoupper($item->causesrisks_name) . '</strong>&nbsp;<small>(' . $key . ')</small></span>', 'checked' => false);
                 $options[] = (object) $tmp;
                 $counter++;
             }
         }
     }
     return $options;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:52,代码来源:causesriskscheck.php

示例8: escape

 /**
  * Escapes a value for output in a view script.
  *
  * @param   mixed  $var  The output to escape.
  *
  * @return  mixed  The escaped value.
  */
 public function escape($var)
 {
     // use the helper htmlEscape method instead.
     return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset);
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:12,代码来源:view.html.php

示例9: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 public function getOptions()
 {
     // get the input from url
     $jinput = JFactory::getApplication()->input;
     // get the view name & id
     $interId = $jinput->getInt('id', 0);
     // Get the user object.
     $user = JFactory::getUser();
     $userIs = CostbenefitprojectionHelper::userIs($user->id);
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select($db->quoteName(array('a.id', 'a.name', 'a.company', 'a.share'), array('id', 'interventions_name', 'company', 'share')));
     $query->from($db->quoteName('#__costbenefitprojection_intervention', 'a'));
     $query->where($db->quoteName('a.published') . ' = 1');
     $query->where($db->quoteName('a.id') . ' != ' . $interId);
     if (!$user->authorise('core.admin')) {
         $companies = CostbenefitprojectionHelper::hisCompanies($user->id);
         if (CostbenefitprojectionHelper::checkArray($companies)) {
             $companies = implode(',', $companies);
             // only load this users companies
             $query->where('a.company IN (' . $companies . ')');
         } else {
             // dont allow user to see any companies
             $query->where('a.company = -4');
         }
     }
     $query->order('a.name ASC');
     $db->setQuery((string) $query);
     $items = $db->loadObjectList();
     $options = array();
     if ($items) {
         foreach ($items as $item) {
             if (!CostbenefitprojectionHelper::checkIntervetionAccess($item->id, $item->share, $item->company)) {
                 continue;
             }
             if (1 == $userIs) {
                 $options[] = JHtml::_('select.option', $item->id, $item->interventions_name);
             } else {
                 $compName = CostbenefitprojectionHelper::getId('company', $item->company, 'id', 'name');
                 $options[] = JHtml::_('select.option', $item->id, $item->interventions_name . ' (' . $compName . ')');
             }
         }
     }
     return $options;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:50,代码来源:interventions.php

示例10: 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

示例11: getOptions

 /**
  * Method to get a list of options for a list input.
  *
  * @return	array		An array of JHtml options.
  */
 public function getOptions()
 {
     $jinput = JFactory::getApplication()->input;
     $client = $jinput->get('id', 0, 'INT');
     $countries = CostbenefitprojectionHelper::hisCountries(null, $client, 'company');
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select($db->quoteName(array('a.year', 'a.country'), array('year', 'country')));
     $query->from($db->quoteName('#__costbenefitprojection_health_data', 'a'));
     $query->where($db->quoteName('a.published') . ' = 1');
     if (CostbenefitprojectionHelper::checkArray($countries)) {
         $query->where($db->quoteName('a.country') . ' IN (' . implode(',', $countries) . ')');
     }
     $query->order('a.country ASC');
     $db->setQuery((string) $query);
     $items = $db->loadObjectList();
     $options = array();
     if ($items) {
         $years = array();
         foreach ($items as $item) {
             if (!CostbenefitprojectionHelper::checkArray($years) || !in_array($item->year . '_' . $item->country, $years)) {
                 if (!CostbenefitprojectionHelper::checkArray($countries) || $client == 0) {
                     $countryName = ' (' . CostbenefitprojectionHelper::getCountryName($item->country) . ')';
                 } else {
                     $countryName = '';
                 }
                 $options[] = JHtml::_('select.option', $item->year, $item->year . $countryName);
                 $years[$item->year] = $item->year . '_' . $item->country;
             }
         }
     }
     return $options;
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:38,代码来源:datayear.php

示例12:

						<?php 
}
?>
					</dl>
				</div>
			</div>
		</div>
	</li>
	<li>
		<div data-uk-margin>
			<?php 
echo $agepercents_numbers;
?>
			<div class="uk-visible-large">
				<?php 
$chartsId = CostbenefitprojectionHelper::randomkey(3);
?>
				<button class="uk-button uk-width-1-1 charttab" data-uk-toggle="{target:'#<?php 
echo $chartsId;
?>
'}"><?php 
echo JText::_('COM_COSTBENEFITPROJECTION_AGE_GROUP_CHARTS');
?>
</button>
				<div id="<?php 
echo $chartsId;
?>
" class="uk-hidden"><?php 
echo $agepercents;
?>
</div>
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:31,代码来源:companydetails.php

示例13: foreach

echo JText::_('COM_COSTBENEFITPROJECTION_RELEASE_DATE');
?>
 <em><?php 
echo $manifest->creationDate;
?>
</em></li>
<li><i class="uk-icon-copyright"></i> <?php 
echo JText::_('COM_COSTBENEFITPROJECTION_COPYRIGHT_GIZ');
?>
</li>
<li><i class="uk-icon-legal"></i> <?php 
echo JText::_('COM_COSTBENEFITPROJECTION_LICENSE_A_TARGET_BLANK_HREFHTTPSWWWGNUORGLICENSESGPLTWOZEROHTMLGNUGPLA_COMMERCIAL');
?>
</li>
<?php 
if (CostbenefitprojectionHelper::checkArray($contributors)) {
    foreach ($contributors as $contributor) {
        ?>
    <li><i class="uk-icon-stack-overflow"></i> <?php 
        echo $contributor['title'];
        ?>
<br /><?php 
        echo $contributor['name'];
        ?>
</li>
<?php 
    }
}
?>
<li><i class="uk-icon-code"></i> <?php 
echo JText::_('COM_COSTBENEFITPROJECTION_APPLICATION_DEVELOPER');
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:31,代码来源:appnotice.php

示例14: 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

示例15: escape

 /**
  * Escapes a value for output in a view script.
  *
  * @param   mixed  $var  The output to escape.
  *
  * @return  mixed  The escaped value.
  */
 public function escape($var, $sorten = false, $length = 40)
 {
     // use the helper htmlEscape method instead.
     return CostbenefitprojectionHelper::htmlEscape($var, $this->_charset, $sorten, $length);
 }
开发者ID:namibia,项目名称:CBP-Joomla-3-Component,代码行数:12,代码来源:view.html.php


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