本文整理匯總了PHP中CostbenefitprojectionHelper::calculate方法的典型用法代碼示例。如果您正苦於以下問題:PHP CostbenefitprojectionHelper::calculate方法的具體用法?PHP CostbenefitprojectionHelper::calculate怎麽用?PHP CostbenefitprojectionHelper::calculate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CostbenefitprojectionHelper
的用法示例。
在下文中一共展示了CostbenefitprojectionHelper::calculate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display
function display($tpl = null)
{
// get combined params of both component and menu
$this->app = JFactory::getApplication();
$this->params = $this->app->getParams();
$this->menu = $this->app->getMenu()->getActive();
// get the user object
$this->user = JFactory::getUser();
// 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);
} else {
// int all as false
$this->results = false;
}
// Set the toolbar
$this->addToolBar();
// set the document
$this->_prepareDocument();
parent::display($tpl);
}
示例2: setCompaniesInfo
protected function setCompaniesInfo(&$items)
{
if (CostbenefitprojectionHelper::checkArray($items)) {
// we must check the currency
$currency = array('currency_id', 'currency_name', 'currency_codethree', 'currency_numericcode', 'currency_symbol', 'currency_thousands', 'currency_decimalplace', 'currency_decimalsymbol', 'currency_positivestyle', 'currency_negativestyle');
$names = array();
$namesnot = array();
foreach ($items as $nr => &$item) {
if (!isset($this->currencyDetails->currency_id)) {
$this->currencyDetails = new stdClass();
foreach ($currency as $key) {
$this->currencyDetails->{$key} = $item->{$key};
}
} elseif ($item->currency_id !== $this->currencyDetails->currency_id) {
$namesnot[] = $item->name;
continue;
}
$data = base64_encode(serialize($item));
$this->datasets[] = CostbenefitprojectionHelper::calculate($item->id, $data);
// set some defaults
$names[] = $item->name;
}
if (CostbenefitprojectionHelper::checkArray($namesnot)) {
$companiesNamesNot = '<b>' . implode(', ', $namesnot) . '</b>';
JError::raiseWarning(500, JText::_('Currency mismatch! These were excluded from results: ') . $companiesNamesNot);
}
if (CostbenefitprojectionHelper::checkArray($names)) {
$this->companiesNames = implode(', ', $names);
return true;
}
}
}
示例3: display
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);
}
示例4: getCalculatedResult
public function getCalculatedResult($id, $data)
{
return CostbenefitprojectionHelper::calculate($id, $data);
}