本文整理汇总了PHP中CostbenefitprojectionHelper::checkObject方法的典型用法代码示例。如果您正苦于以下问题:PHP CostbenefitprojectionHelper::checkObject方法的具体用法?PHP CostbenefitprojectionHelper::checkObject怎么用?PHP CostbenefitprojectionHelper::checkObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CostbenefitprojectionHelper
的用法示例。
在下文中一共展示了CostbenefitprojectionHelper::checkObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: array
$scalingfactors = '<table class="footable metro-blue toggle-circle" data-page-size="10"><thead><tr>' . $head . '</tr></thead><tbody>' . $body . '</tbody><tfoot class="hide-if-no-paging"><tr><td colspan="10"><div class="pagination pagination-centered"></div></td></tr></tfoot></table>';
}
// set interventions
$interventions = '<div class="uk-alert">' . JText::_('COM_COSTBENEFITPROJECTION_NO_INTERVENTIONS_SET') . '</div>';
if (isset($displayData->idCompanyInterventionE) && CostbenefitprojectionHelper::checkArray($displayData->idCompanyInterventionE)) {
// the values to display
$keys = array('id' => JText::_('ID'), 'name' => JText::_('COM_COSTBENEFITPROJECTION_NAME'), 'type' => JText::_('COM_COSTBENEFITPROJECTION_TYPE'), 'coverage' => JText::_('COM_COSTBENEFITPROJECTION_COVERAGE'), 'share' => JText::_('COM_COSTBENEFITPROJECTION_SHARE'), 'description' => JText::_('COM_COSTBENEFITPROJECTION_DESCRIPTION'), 'reference' => JText::_('COM_COSTBENEFITPROJECTION_REFERENCE'), 'intervention' => JText::_('COM_COSTBENEFITPROJECTION_INTERVENTION'), 'published' => JText::_('COM_COSTBENEFITPROJECTION_STATUS'));
$rows = array('published' => 'setPublised', 'intervention' => 'setIntervention', 'name' => 'setInterventionLink', 'type' => 'setInterventionType', 'share' => 'setInterventionShare');
// header switces
$datahide = array('id' => ' data-ignore="true" data-hide="all"', 'share' => ' data-hide="phone,tablet"', 'description' => ' data-hide="all"', 'reference' => ' data-hide="all"', 'intervention' => ' data-hide="all"');
$datatype = array('id' => ' data-type="numeric"', 'coverage' => ' data-type="numeric"');
$datatoggle = array('name' => ' data-toggle="true"');
// set the body
$body = '';
foreach ($displayData->idCompanyInterventionE as $details) {
if (CostbenefitprojectionHelper::checkObject($details)) {
// build the dl list
$body .= '<tr>';
foreach ($keys as $key => $header) {
if (array_key_exists($key, $rows)) {
// this should be save since all data passed is internal
$body .= "{$rows[$key]($details)}";
} else {
$body .= '<td>' . $details->{$key} . '</td>';
}
}
$body .= '</tr>';
}
}
// set the header dynamic
$head = '';
示例3: defined
/-------------------------------------------------------------------------------------------------------/
Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$scaled = array('unscaled', 'scaled');
?>
<div id="view_wdls">
<h1><?php
echo JText::_('COM_COSTBENEFITPROJECTION_WORK_DAYS_LOST_SUMMARY');
?>
</h1>
<?php
echo JText::_('COM_COSTBENEFITPROJECTION_TOTAL_DAYS_LOST_AND_CONTRIBUTION_OF_MORBIDITY_MORTALITY_AND_RISK_FACTORS');
if (isset($this->results->items) && CostbenefitprojectionHelper::checkObject($this->results->items)) {
?>
<br /><?php
echo JText::_('COM_COSTBENEFITPROJECTION_PERCENT_OF_BESTIMATED_BURDENB_BEING_TARGETED_BY_THIS_DISEASERISK_SELECTION');
?>
<b>(<?php
echo round($this->results->totals->total_estimated_burden, 3) . '%';
?>
)</b>
<?php
foreach ($scaled as $scale) {
?>
<table id="theTableWDLS_<?php
echo $scale;
?>
" class="footable table data metro-blue <?php
示例4: getExportData
/**
* Method to get list export data.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks)
{
// setup the query
if (CostbenefitprojectionHelper::checkArray($pks)) {
// Set a value to know this is exporting method.
$_export = true;
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the costbenefitprojection_causerisk table
$query->from($db->quoteName('#__costbenefitprojection_causerisk', 'a'));
$query->where('a.id IN (' . implode(',', $pks) . ')');
// Implement View Level Access
if (!$user->authorise('core.options', 'com_costbenefitprojection')) {
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Order the results by ordering
$query->order('a.ordering ASC');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows()) {
$items = $db->loadObjectList();
// set values to display correctly.
if (CostbenefitprojectionHelper::checkArray($items)) {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) {
$access = $user->authorise('causerisk.access', 'com_costbenefitprojection.causerisk.' . (int) $item->id) && $user->authorise('causerisk.access', 'com_costbenefitprojection');
if (!$access) {
unset($items[$nr]);
continue;
}
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (CostbenefitprojectionHelper::checkObject($headers)) {
array_unshift($items, $headers);
}
return $items;
}
}
return false;
}
示例5: setItems
protected function setItems($items)
{
if (CostbenefitprojectionHelper::checkObject($items)) {
$dont = array('male', 'female', 'details');
foreach ($items as $id => $values) {
if (CostbenefitprojectionHelper::checkObject($values)) {
if (!isset($this->items->{$id})) {
$this->items->{$id} = new stdClass();
$this->items->{$id}->details = $values->details;
}
foreach ($values as $name => $value) {
if (!in_array($name, $dont)) {
if (strpos($name, 'money') == false) {
if (isset($this->items->{$id}->{$name})) {
$this->items->{$id}->{$name} += $value;
} else {
$this->items->{$id}->{$name} = $value;
}
} else {
if (!isset($this->moneyMachine['items_' . $id][$name])) {
// setup money making machine
$numberString = str_replace('money', '', $name);
$this->moneyMachine['items_' . $id][$name] = $numberString;
}
}
}
}
}
}
}
}
示例6: getExportData
/**
* Method to get list export data.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks)
{
// setup the query
if (CostbenefitprojectionHelper::checkArray($pks)) {
// Set a value to know this is exporting method.
$_export = true;
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the costbenefitprojection_company table
$query->from($db->quoteName('#__costbenefitprojection_company', 'a'));
$query->where('a.id IN (' . implode(',', $pks) . ')');
// Filter by companies (admin sees all)
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');
}
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_costbenefitprojection')) {
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Order the results by ordering
$query->order('a.ordering ASC');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows()) {
$items = $db->loadObjectList();
// Get the advanced encription key.
$advancedkey = CostbenefitprojectionHelper::getCryptKey('advanced');
// Get the encription object.
$advanced = new FOFEncryptAes($advancedkey, 256);
// set values to display correctly.
if (CostbenefitprojectionHelper::checkArray($items)) {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) {
$access = $user->authorise('company.access', 'com_costbenefitprojection.company.' . (int) $item->id) && $user->authorise('company.access', 'com_costbenefitprojection');
if (!$access) {
unset($items[$nr]);
continue;
}
if ($advancedkey && !is_numeric($item->medical_turnovers_females) && $item->medical_turnovers_females === base64_encode(base64_decode($item->medical_turnovers_females, true))) {
// decrypt medical_turnovers_females
$item->medical_turnovers_females = $advanced->decryptString($item->medical_turnovers_females);
}
if ($advancedkey && !is_numeric($item->females) && $item->females === base64_encode(base64_decode($item->females, true))) {
// decrypt females
$item->females = $advanced->decryptString($item->females);
}
if ($advancedkey && !is_numeric($item->sick_leave_males) && $item->sick_leave_males === base64_encode(base64_decode($item->sick_leave_males, true))) {
// decrypt sick_leave_males
$item->sick_leave_males = $advanced->decryptString($item->sick_leave_males);
}
if ($advancedkey && !is_numeric($item->medical_turnovers_males) && $item->medical_turnovers_males === base64_encode(base64_decode($item->medical_turnovers_males, true))) {
// decrypt medical_turnovers_males
$item->medical_turnovers_males = $advanced->decryptString($item->medical_turnovers_males);
}
if ($advancedkey && !is_numeric($item->total_salary) && $item->total_salary === base64_encode(base64_decode($item->total_salary, true))) {
// decrypt total_salary
$item->total_salary = $advanced->decryptString($item->total_salary);
}
if ($advancedkey && !is_numeric($item->sick_leave_females) && $item->sick_leave_females === base64_encode(base64_decode($item->sick_leave_females, true))) {
// decrypt sick_leave_females
$item->sick_leave_females = $advanced->decryptString($item->sick_leave_females);
}
if ($advancedkey && !is_numeric($item->total_healthcare) && $item->total_healthcare === base64_encode(base64_decode($item->total_healthcare, true))) {
// decrypt total_healthcare
$item->total_healthcare = $advanced->decryptString($item->total_healthcare);
}
if ($advancedkey && !is_numeric($item->males) && $item->males === base64_encode(base64_decode($item->males, true))) {
// decrypt males
$item->males = $advanced->decryptString($item->males);
}
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (CostbenefitprojectionHelper::checkObject($headers)) {
//.........这里部分代码省略.........
示例7: getExportData
/**
* Method to get list export data.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getExportData($pks)
{
// setup the query
if (CostbenefitprojectionHelper::checkArray($pks)) {
// Set a value to know this is exporting method.
$_export = true;
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the costbenefitprojection_intervention table
$query->from($db->quoteName('#__costbenefitprojection_intervention', 'a'));
$query->where('a.id IN (' . implode(',', $pks) . ')');
// Filter the companies (admin sees all)
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.company IN (' . $companies . ')');
} else {
// don't allow user to see any companies
$query->where('a.company = -4');
}
}
// Order the results by ordering
$query->order('a.ordering ASC');
// Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows()) {
$items = $db->loadObjectList();
// set values to display correctly.
if (CostbenefitprojectionHelper::checkArray($items)) {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) {
$access = $user->authorise('intervention.access', 'com_costbenefitprojection.intervention.' . (int) $item->id) && $user->authorise('intervention.access', 'com_costbenefitprojection');
if (!$access) {
unset($items[$nr]);
continue;
}
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
// Add headers to items array.
$headers = $this->getExImPortHeaders();
if (CostbenefitprojectionHelper::checkObject($headers)) {
array_unshift($items, $headers);
}
// check if item is to load based on sharing setting
if (CostbenefitprojectionHelper::checkArray($items)) {
foreach ($items as $nr => &$item) {
if (!CostbenefitprojectionHelper::checkIntervetionAccess($item->id, $item->share, $item->company)) {
unset($items[$nr]);
continue;
}
}
}
return $items;
}
}
return false;
}
示例8: setCompany
public function setCompany()
{
if (CostbenefitprojectionHelper::checkObject($this->company)) {
// main switch
$usecountry = false;
// public switch
if (isset($this->company->public)) {
$usecountry = true;
$cKey = 'id';
} else {
$cKey = 'country';
}
// set array of json objects to convert to array
$jsonObjects = array('percentmale', 'percentfemale', 'country_percentmale', 'country_percentfemale', 'country_maledeath', 'country_femaledeath', 'country_maleyld', 'country_femaleyld');
$removeArray = array('asset_id', 'not_required', 'published', 'created_by', 'country_created_by', 'country_created', 'country_version', 'country_hits', 'country_ordering', 'modified_by', 'country_asset_id', 'created', 'modified', 'version', 'hits', 'ordering', 'country_published', 'country_modified_by', 'country_modified', 'country_maledeath', 'country_femaledeath', 'country_maleyld', 'country_femaleyld', 'idCompanyScaling_factorC', $cKey . 'CountryHealth_dataB', $cKey . 'CountryHealth_dataBB', 'causesrisksIdCauseriskG', 'causesrisksIdCauseriskGG', 'idCompanyInterventionD', 'countryCountryInterventionDD', 'idCountryInterventionDD');
foreach ($jsonObjects as $jsonObject) {
if (isset($this->company->{$jsonObject}) && CostbenefitprojectionHelper::isJson($this->company->{$jsonObject})) {
// convert to array
$array = json_decode($this->company->{$jsonObject}, true);
if (CostbenefitprojectionHelper::checkArray($array)) {
$this->company->{$jsonObject} = array();
foreach ($array as $option => $values) {
if (CostbenefitprojectionHelper::checkArray($values)) {
foreach ($values as $nr => $value) {
$this->company->{$jsonObject}[$nr][$option] = $value;
}
}
}
}
}
}
// if company has not causerisks selected fall back on country
if ($usecountry || isset($this->company->causesrisks) && !CostbenefitprojectionHelper::checkArray($this->company->causesrisks) || $this->company->department == 1) {
$this->company->causesrisks = $this->company->country_causesrisks;
$this->company->medical_turnovers_males = $this->company->males * ($this->company->country_medical_turnovers / 100000);
$this->company->medical_turnovers_females = $this->company->females * ($this->company->country_medical_turnovers / 100000);
$this->company->sick_leave_males = $this->company->males * $this->company->country_sick_leave;
$this->company->sick_leave_females = $this->company->females * $this->company->country_sick_leave;
$this->company->datayear = $this->company->country_datayear;
$this->company->total_healthcare = $this->company->country_healthcare / 100 * $this->company->total_salary;
$this->company->working_days = $this->company->country_working_days;
$this->company->productivity_losses = $this->company->country_productivity_losses;
$usecountry = true;
}
// percent sorting
$percentSort = array('percentmale', 'percentfemale', 'country_percentmale', 'country_percentfemale');
foreach ($percentSort as $sort) {
$point = $sort;
if (isset($this->company->{$sort}) && !CostbenefitprojectionHelper::checkArray($this->company->{$sort}) && strpos($sort, 'country') === false) {
$sort = 'country_' . $sort;
}
if (isset($this->company->{$sort}) && CostbenefitprojectionHelper::checkArray($this->company->{$sort})) {
$bucket = array();
foreach ($this->company->{$sort} as $value) {
$bucket[$value['age']] = (int) $value['percent'];
}
$this->company->{$point} = $bucket;
}
}
// country totals sorting
$countrySort = array('country_maledeath' => array('gender' => 'male', 'type' => 'death'), 'country_femaledeath' => array('gender' => 'female', 'type' => 'death'), 'country_maleyld' => array('gender' => 'male', 'type' => 'yld'), 'country_femaleyld' => array('gender' => 'female', 'type' => 'yld'));
$this->company->country_yld = 0;
$this->company->country_death = 0;
foreach ($countrySort as $sort => $tar) {
if (isset($this->company->{$sort}) && CostbenefitprojectionHelper::checkArray($this->company->{$sort})) {
foreach ($this->company->{$sort} as $value) {
if ($this->company->datayear == $value['year']) {
$this->company->{'country_' . $tar['type']} += $value['number'];
}
}
}
}
// country health totals sorting
$specialSort = array('maledeath', 'maleyld', 'femaledeath', 'femaleyld');
$keepData = array();
if (isset($this->company->{$cKey . 'CountryHealth_dataB'}) && CostbenefitprojectionHelper::checkArray($this->company->{$cKey . 'CountryHealth_dataB'}) && !$usecountry) {
$healthBucket = array();
foreach ($this->company->{$cKey . 'CountryHealth_dataB'} as $healthData) {
$healthBucket[$healthData->causerisk] = new stdClass();
foreach ($specialSort as $sort) {
if (isset($healthData->{$sort}) && CostbenefitprojectionHelper::isJson($healthData->{$sort})) {
// convert to array
$array = json_decode($healthData->{$sort}, true);
if (CostbenefitprojectionHelper::checkArray($array)) {
foreach ($array as $option => $values) {
if (CostbenefitprojectionHelper::checkArray($values)) {
foreach ($values as $nr => $value) {
$healthBucket[$healthData->causerisk]->{$sort}[$nr][$option] = $value;
}
}
}
}
}
}
// number sorting
foreach ($specialSort as $sort) {
if (isset($healthBucket[$healthData->causerisk]->{$sort}) && CostbenefitprojectionHelper::checkArray($healthBucket[$healthData->causerisk]->{$sort})) {
$bucket = array();
foreach ($healthBucket[$healthData->causerisk]->{$sort} as $value) {
if (CostbenefitprojectionHelper::checkArray($value)) {
//.........这里部分代码省略.........