本文整理汇总了PHP中CostbenefitprojectionHelper::checkString方法的典型用法代码示例。如果您正苦于以下问题:PHP CostbenefitprojectionHelper::checkString方法的具体用法?PHP CostbenefitprojectionHelper::checkString怎么用?PHP CostbenefitprojectionHelper::checkString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CostbenefitprojectionHelper
的用法示例。
在下文中一共展示了CostbenefitprojectionHelper::checkString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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');
}
}
示例4: validate
/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return mixed Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 12.2
*/
public function validate($form, $data, $group = null)
{
// check if the not_required field is set
if (CostbenefitprojectionHelper::checkString($data['not_required'])) {
$requiredFields = (array) explode(',', (string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
// now change the required field attributes value
foreach ($requiredFields as $requiredField) {
// make sure there is a string value
if (CostbenefitprojectionHelper::checkString($requiredField)) {
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
}
}
}
return parent::validate($form, $data, $group);
}
示例5: array
// this should be save since all data passed is internal
$head .= $dataSwitch[$key];
}
$head .= '>' . $header . '</th>';
}
$causesrisks .= '<table class="footable metro-blue toggle-circle" data-page-size="10"><thead><tr>' . $head . '</li></tr></thead><tbody>' . $body . '</tbody><tfoot class="hide-if-no-paging"><tr><td colspan="4"><div class="pagination pagination-centered"></div></td></tr></tfoot></table>';
}
// setup the age groups display
$agepercents = '<div class="uk-panel uk-width-1-1"><div class="uk-alert">' . JText::_('COM_COSTBENEFITPROJECTION_NO_AGE_GROUPS_HAS_BEEN_SET') . '</div></div>';
$agepercents_numbers = '<div class="uk-panel uk-width-1-1"><div class="uk-alert">' . JText::_('COM_COSTBENEFITPROJECTION_NO_AGE_GROUPS_HAS_BEEN_SET') . '</div></div>';
$genderArray = array('male', 'female');
// loading option var
$both = 0;
foreach ($genderArray as $gender) {
// setup the related gender age groups
if (isset($displayData->{'percent' . $gender}) && CostbenefitprojectionHelper::checkString($displayData->{'percent' . $gender})) {
// load chart builder
$chart = new Chartbuilder('PieChart');
$i = 0;
$data = array();
$rowArray = array();
$rowArray_numbers = array();
$dataset = json_decode($displayData->{'percent' . $gender});
foreach ($dataset as $key => &$set) {
if ('age' == $key) {
$type = 'string';
$percent = false;
} else {
$type = 'number';
$percent = true;
}
示例6: selectionTranslationVwhcompanies
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslationVwhcompanies($value, $name)
{
// Array of department language strings
if ($name == 'department') {
$departmentArray = array(1 => 'COM_COSTBENEFITPROJECTION_COMPANY_BASIC', 2 => 'COM_COSTBENEFITPROJECTION_COMPANY_ADVANCED');
// Now check if value is found in this array
if (isset($departmentArray[$value]) && CostbenefitprojectionHelper::checkString($departmentArray[$value])) {
return $departmentArray[$value];
}
}
// Array of per language strings
if ($name == 'per') {
$perArray = array(1 => 'COM_COSTBENEFITPROJECTION_COMPANY_OPEN', 0 => 'COM_COSTBENEFITPROJECTION_COMPANY_LOCKED');
// Now check if value is found in this array
if (isset($perArray[$value]) && CostbenefitprojectionHelper::checkString($perArray[$value])) {
return $perArray[$value];
}
}
return $value;
}
示例7: selectionTranslation
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslation($value, $name)
{
// Array of type language strings
if ($name == 'type') {
$typeArray = array(0 => 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SELECT_AN_OPTION', 1 => 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_JOOMLA_ARTICLE', 2 => 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_TEXT', 3 => 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_URL');
// Now check if value is found in this array
if (isset($typeArray[$value]) && CostbenefitprojectionHelper::checkString($typeArray[$value])) {
return $typeArray[$value];
}
}
// Array of location language strings
if ($name == 'location') {
$locationArray = array(1 => 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_ADMIN', 2 => 'COM_COSTBENEFITPROJECTION_HELP_DOCUMENT_SITE');
// Now check if value is found in this array
if (isset($locationArray[$value]) && CostbenefitprojectionHelper::checkString($locationArray[$value])) {
return $locationArray[$value];
}
}
return $value;
}
示例8: getIcons
public function getIcons()
{
// load user for access menus
$user = JFactory::getUser();
// reset icon array
$icons = array();
// view groups array
$viewGroups = array('main' => array('png.company.add', 'png.companies', 'png.service_provider.add', 'png.service_providers', 'png.countries', 'png.causerisk.add', 'png.causesrisks', 'png.health_data_sets', 'png.scaling_factor.add', 'png.scaling_factors', 'png.intervention.add', 'png.interventions', 'png.currencies', 'png.help_documents'));
// view access array
$viewAccess = array('combinedresults.dashboard_list' => 'combinedresults.dashboard_list', 'company.create' => 'company.create', 'companies.access' => 'company.access', 'company.access' => 'company.access', 'companies.submenu' => 'company.submenu', 'companies.dashboard_list' => 'company.dashboard_list', 'company.dashboard_add' => 'company.dashboard_add', 'service_provider.create' => 'service_provider.create', 'service_providers.access' => 'service_provider.access', 'service_provider.access' => 'service_provider.access', 'service_providers.submenu' => 'service_provider.submenu', 'service_providers.dashboard_list' => 'service_provider.dashboard_list', 'service_provider.dashboard_add' => 'service_provider.dashboard_add', 'country.create' => 'country.create', 'countries.access' => 'country.access', 'country.access' => 'country.access', 'countries.submenu' => 'country.submenu', 'countries.dashboard_list' => 'country.dashboard_list', 'causerisk.create' => 'causerisk.create', 'causesrisks.access' => 'causerisk.access', 'causerisk.access' => 'causerisk.access', 'causesrisks.submenu' => 'causerisk.submenu', 'causesrisks.dashboard_list' => 'causerisk.dashboard_list', 'causerisk.dashboard_add' => 'causerisk.dashboard_add', 'health_data.create' => 'health_data.create', 'health_data_sets.access' => 'health_data.access', 'health_data.access' => 'health_data.access', 'health_data_sets.submenu' => 'health_data.submenu', 'health_data_sets.dashboard_list' => 'health_data.dashboard_list', 'scaling_factor.create' => 'scaling_factor.create', 'scaling_factors.access' => 'scaling_factor.access', 'scaling_factor.access' => 'scaling_factor.access', 'scaling_factors.submenu' => 'scaling_factor.submenu', 'scaling_factors.dashboard_list' => 'scaling_factor.dashboard_list', 'scaling_factor.dashboard_add' => 'scaling_factor.dashboard_add', 'intervention.create' => 'intervention.create', 'interventions.access' => 'intervention.access', 'intervention.access' => 'intervention.access', 'interventions.submenu' => 'intervention.submenu', 'interventions.dashboard_list' => 'intervention.dashboard_list', 'intervention.dashboard_add' => 'intervention.dashboard_add', 'currency.create' => 'currency.create', 'currencies.access' => 'currency.access', 'currency.access' => 'currency.access', 'currencies.submenu' => 'currency.submenu', 'currencies.dashboard_list' => 'currency.dashboard_list', 'help_document.create' => 'help_document.create', 'help_documents.access' => 'help_document.access', 'help_document.access' => 'help_document.access', 'help_documents.submenu' => 'help_document.submenu', 'help_documents.dashboard_list' => 'help_document.dashboard_list');
foreach ($viewGroups as $group => $views) {
$i = 0;
if (CostbenefitprojectionHelper::checkArray($views)) {
foreach ($views as $view) {
$add = false;
if (strpos($view, '.') !== false) {
$dwd = explode('.', $view);
if (count($dwd) == 3) {
list($type, $name, $action) = $dwd;
} elseif (count($dwd) == 2) {
list($type, $name) = $dwd;
$action = false;
}
if ($action) {
$viewName = $name;
switch ($action) {
case 'add':
$url = 'index.php?option=com_costbenefitprojection&view=' . $name . '&layout=edit';
$image = $name . '_' . $action . '.' . $type;
$alt = $name . ' ' . $action;
$name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name, 'U') . '_ADD';
$add = true;
break;
default:
$url = 'index.php?option=com_categories&view=categories&extension=com_costbenefitprojection.' . $name;
$image = $name . '_' . $action . '.' . $type;
$alt = $name . ' ' . $action;
$name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name, 'U') . '_' . CostbenefitprojectionHelper::safeString($action, 'U');
break;
}
} else {
$viewName = $name;
$alt = $name;
$url = 'index.php?option=com_costbenefitprojection&view=' . $name;
$image = $name . '.' . $type;
$name = 'COM_COSTBENEFITPROJECTION_DASHBOARD_' . CostbenefitprojectionHelper::safeString($name, 'U');
$hover = false;
}
} else {
$viewName = $view;
$alt = $view;
$url = 'index.php?option=com_costbenefitprojection&view=' . $view;
$image = $view . '.png';
$name = ucwords($view) . '<br /><br />';
$hover = false;
}
// first make sure the view access is set
if (CostbenefitprojectionHelper::checkArray($viewAccess)) {
// setup some defaults
$dashboard_add = false;
$dashboard_list = false;
$accessTo = '';
$accessAdd = '';
// acces checking start
$accessCreate = isset($viewAccess[$viewName . '.create']) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName . '.create']) : false;
$accessAccess = isset($viewAccess[$viewName . '.access']) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName . '.access']) : false;
// set main controllers
$accessDashboard_add = isset($viewAccess[$viewName . '.dashboard_add']) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName . '.dashboard_add']) : false;
$accessDashboard_list = isset($viewAccess[$viewName . '.dashboard_list']) ? CostbenefitprojectionHelper::checkString($viewAccess[$viewName . '.dashboard_list']) : false;
// check for adding access
if ($add && $accessCreate) {
$accessAdd = $viewAccess[$viewName . '.create'];
} elseif ($add) {
$accessAdd = 'core.create';
}
// check if acces to view is set
if ($accessAccess) {
$accessTo = $viewAccess[$viewName . '.access'];
}
// set main access controllers
if ($accessDashboard_add) {
$dashboard_add = $user->authorise($viewAccess[$viewName . '.dashboard_add'], 'com_costbenefitprojection');
}
if ($accessDashboard_list) {
$dashboard_list = $user->authorise($viewAccess[$viewName . '.dashboard_list'], 'com_costbenefitprojection');
}
if (CostbenefitprojectionHelper::checkString($accessAdd) && CostbenefitprojectionHelper::checkString($accessTo)) {
// check access
if ($user->authorise($accessAdd, 'com_costbenefitprojection') && $user->authorise($accessTo, 'com_costbenefitprojection') && $dashboard_add) {
$icons[$group][$i] = new StdClass();
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
} elseif (CostbenefitprojectionHelper::checkString($accessTo)) {
// check access
if ($user->authorise($accessTo, 'com_costbenefitprojection') && $dashboard_list) {
$icons[$group][$i] = new StdClass();
$icons[$group][$i]->url = $url;
//.........这里部分代码省略.........
示例9: selectionTranslation
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslation($value, $name)
{
// Array of year language strings
if ($name == 'year') {
$yearArray = array(0 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_SELECT_A_YEAR', 2010 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TEN', 2011 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_ELEVEN', 2012 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWELVE', 2013 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_THIRTEEN', 2014 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_FOURTEEN', 2015 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_FIFTEEN', 2016 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_SIXTEEN', 2017 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_SEVENTEEN', 2018 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_EIGHTEEN', 2019 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_NINETEEN', 2020 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY', 2021 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY_ONE', 2022 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY_TWO', 2023 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY_THREE', 2024 => 'COM_COSTBENEFITPROJECTION_HEALTH_DATA_TWO_THOUSAND_AND_TWENTY_FOUR');
// Now check if value is found in this array
if (isset($yearArray[$value]) && CostbenefitprojectionHelper::checkString($yearArray[$value])) {
return $yearArray[$value];
}
}
return $value;
}
示例10: selectionTranslation
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslation($value, $name)
{
// Array of type language strings
if ($name == 'type') {
$typeArray = array(1 => 'COM_COSTBENEFITPROJECTION_INTERVENTION_SINGLE', 2 => 'COM_COSTBENEFITPROJECTION_INTERVENTION_CLUSTER');
// Now check if value is found in this array
if (isset($typeArray[$value]) && CostbenefitprojectionHelper::checkString($typeArray[$value])) {
return $typeArray[$value];
}
}
return $value;
}
示例11: addToolBar
/**
* Setting the toolbar
*/
protected function addToolBar()
{
// adding the joomla toolbar to the front
JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR . '/includes/toolbar.php');
// set help url for this view if found
$help_url = CostbenefitprojectionHelper::getHelpUrl('combinedresults');
if (CostbenefitprojectionHelper::checkString($help_url)) {
JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url);
}
// now initiate the toolbar
$this->toolbar = JToolbar::getInstance();
}
示例12: getItem
/**
* Method to get article data.
*
* @param integer $pk The id of the article.
*
* @return mixed Menu item data object on success, false on failure.
*/
public function getItem($pk = null)
{
$this->user = JFactory::getUser();
// check if this user has permission to access item
if (!$this->user->authorise('site.companyresults.access', 'com_costbenefitprojection')) {
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('Not authorised!'), 'error');
// redirect away if not a correct (TODO for now we go to default view)
$app->redirect(JRoute::_('index.php?option=com_costbenefitprojection&view=cpanel'));
return false;
}
$this->userId = $this->user->get('id');
$this->guest = $this->user->get('guest');
$this->groups = $this->user->get('groups');
$this->authorisedGroups = $this->user->getAuthorisedGroups();
$this->levels = $this->user->getAuthorisedViewLevels();
$this->initSet = true;
$pk = !empty($pk) ? $pk : (int) $this->getState('companyresults.id');
if (!$this->user->authorise('core.options', 'com_costbenefitprojection')) {
// make absolutely sure that this company can be viewed
$companies = CostbenefitprojectionHelper::hisCompanies($this->userId);
if (!CostbenefitprojectionHelper::checkArray($companies) || !in_array($pk, $companies)) {
JError::raiseWarning(500, JText::_('Access denied!'));
// redirect away if not a correct (TODO for now we go to default view)
$app = JFactory::getApplication();
if ($app->isAdmin()) {
JFactory::getApplication()->redirect('index.php?option=com_costbenefitprojection');
} else {
JFactory::getApplication()->redirect('index.php?option=com_costbenefitprojection&view=cpanel');
}
return false;
}
}
if ($this->_item === null) {
$this->_item = array();
}
if (!isset($this->_item[$pk])) {
try {
// Get the advanced encription.
$advancedkey = CostbenefitprojectionHelper::getCryptKey('advanced');
// Get the encription object.
$advanced = new FOFEncryptAes($advancedkey, 256);
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Get from #__costbenefitprojection_company as a
$query->select($db->quoteName(array('a.id', 'a.name', 'a.user', 'a.department', 'a.per', 'a.country', 'a.service_provider', 'a.datayear', 'a.working_days', 'a.total_salary', 'a.total_healthcare', 'a.productivity_losses', 'a.males', 'a.females', 'a.medical_turnovers_males', 'a.medical_turnovers_females', 'a.sick_leave_males', 'a.sick_leave_females', 'a.percentmale', 'a.percentfemale', 'a.causesrisks', 'a.published', 'a.access'), array('id', 'name', 'user', 'department', 'per', 'country', 'service_provider', 'datayear', 'working_days', 'total_salary', 'total_healthcare', 'productivity_losses', 'males', 'females', 'medical_turnovers_males', 'medical_turnovers_females', 'sick_leave_males', 'sick_leave_females', 'percentmale', 'percentfemale', 'causesrisks', 'published', 'access')));
$query->from($db->quoteName('#__costbenefitprojection_company', 'a'));
// Get from #__costbenefitprojection_country as e
$query->select($db->quoteName(array('e.id', 'e.name', 'e.alias', 'e.user', 'e.currency', 'e.datayear', 'e.worldzone', 'e.codethree', 'e.codetwo', 'e.working_days', 'e.presenteeism', 'e.medical_turnovers', 'e.sick_leave', 'e.healthcare', 'e.productivity_losses', 'e.publicname', 'e.publicemail', 'e.publicnumber', 'e.publicaddress', 'e.percentmale', 'e.percentfemale', 'e.causesrisks', 'e.maledeath', 'e.femaledeath', 'e.maleyld', 'e.femaleyld', 'e.access'), array('country_id', 'country_name', 'country_alias', 'country_user', 'country_currency', 'country_datayear', 'country_worldzone', 'country_codethree', 'country_codetwo', 'country_working_days', 'country_presenteeism', 'country_medical_turnovers', 'country_sick_leave', 'country_healthcare', 'country_productivity_losses', 'country_publicname', 'country_publicemail', 'country_publicnumber', 'country_publicaddress', 'country_percentmale', 'country_percentfemale', 'country_causesrisks', 'country_maledeath', 'country_femaledeath', 'country_maleyld', 'country_femaleyld', 'country_access')));
$query->join('LEFT', $db->quoteName('#__costbenefitprojection_country', 'e') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('e.id') . ')');
// Get from #__costbenefitprojection_currency as f
$query->select($db->quoteName(array('f.id', 'f.name', 'f.alias', 'f.codethree', 'f.numericcode', 'f.symbol', 'f.thousands', 'f.decimalplace', 'f.decimalsymbol', 'f.positivestyle', 'f.negativestyle', 'f.published', 'f.access', 'f.ordering'), array('currency_id', 'currency_name', 'currency_alias', 'currency_codethree', 'currency_numericcode', 'currency_symbol', 'currency_thousands', 'currency_decimalplace', 'currency_decimalsymbol', 'currency_positivestyle', 'currency_negativestyle', 'currency_published', 'currency_access', 'currency_ordering')));
$query->join('LEFT', $db->quoteName('#__costbenefitprojection_currency', 'f') . ' ON (' . $db->quoteName('e.currency') . ' = ' . $db->quoteName('f.codethree') . ')');
$query->where('a.id = ' . (int) $pk);
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a stdClass object.
$data = $db->loadObject();
if (empty($data)) {
$app = JFactory::getApplication();
// If no data is found redirect to default page and show warning.
$app->enqueueMessage(JText::_('COM_COSTBENEFITPROJECTION_NOT_FOUND_OR_ACCESS_DENIED'), 'warning');
$app->redirect('index.php?option=com_costbenefitprojection&view=cpanel');
return false;
}
if (!empty($data->medical_turnovers_females) && $advancedkey && !is_numeric($data->medical_turnovers_females) && $data->medical_turnovers_females === base64_encode(base64_decode($data->medical_turnovers_females, true))) {
// Decode medical_turnovers_females
$data->medical_turnovers_females = rtrim($advanced->decryptString($data->medical_turnovers_females), "");
}
if (!empty($data->females) && $advancedkey && !is_numeric($data->females) && $data->females === base64_encode(base64_decode($data->females, true))) {
// Decode females
$data->females = rtrim($advanced->decryptString($data->females), "");
}
if (!empty($data->sick_leave_males) && $advancedkey && !is_numeric($data->sick_leave_males) && $data->sick_leave_males === base64_encode(base64_decode($data->sick_leave_males, true))) {
// Decode sick_leave_males
$data->sick_leave_males = rtrim($advanced->decryptString($data->sick_leave_males), "");
}
if (CostbenefitprojectionHelper::checkString($data->causesrisks)) {
// Decode causesrisks
$data->causesrisks = json_decode($data->causesrisks, true);
}
if (!empty($data->medical_turnovers_males) && $advancedkey && !is_numeric($data->medical_turnovers_males) && $data->medical_turnovers_males === base64_encode(base64_decode($data->medical_turnovers_males, true))) {
// Decode medical_turnovers_males
$data->medical_turnovers_males = rtrim($advanced->decryptString($data->medical_turnovers_males), "");
}
if (!empty($data->total_salary) && $advancedkey && !is_numeric($data->total_salary) && $data->total_salary === base64_encode(base64_decode($data->total_salary, true))) {
// Decode total_salary
$data->total_salary = rtrim($advanced->decryptString($data->total_salary), "");
}
if (!empty($data->sick_leave_females) && $advancedkey && !is_numeric($data->sick_leave_females) && $data->sick_leave_females === base64_encode(base64_decode($data->sick_leave_females, true))) {
// Decode sick_leave_females
//.........这里部分代码省略.........
示例13: getCountryCountryInterventionBcbb_DD
/**
* Method to get an array of Intervention Objects.
*
* @return mixed An array of Intervention Objects on success, false on failure.
*
*/
public function getCountryCountryInterventionBcbb_DD($country)
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Get from #__costbenefitprojection_intervention as dd
$query->select($db->quoteName(array('dd.id', 'dd.name', 'dd.type', 'dd.coverage', 'dd.duration', 'dd.share', 'dd.description', 'dd.reference', 'dd.interventions', 'dd.intervention', 'dd.published', 'dd.created_by', 'dd.modified_by', 'dd.created', 'dd.modified'), array('id', 'name', 'type', 'coverage', 'duration', 'share', 'description', 'reference', 'interventions', 'intervention', 'published', 'created_by', 'modified_by', 'created', 'modified')));
$query->from($db->quoteName('#__costbenefitprojection_intervention', 'dd'));
$query->where('dd.country = ' . $db->quote($country));
$query->where('dd.published = 1');
$query->order('dd.ordering ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
// check if there was data returned
if ($db->getNumRows()) {
$items = $db->loadObjectList();
// Convert the parameter fields into objects.
foreach ($items as $nr => &$item) {
if (CostbenefitprojectionHelper::checkString($item->interventions)) {
// Decode interventions
$item->interventions = json_decode($item->interventions, true);
}
// Make sure the content prepare plugins fire on description.
$item->description = JHtml::_('content.prepare', $item->description);
// Checking if description has uikit components that must be loaded.
$this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->description, $this->uikitComp);
// Make sure the content prepare plugins fire on reference.
$item->reference = JHtml::_('content.prepare', $item->reference);
// Checking if reference has uikit components that must be loaded.
$this->uikitComp = CostbenefitprojectionHelper::getUikitComp($item->reference, $this->uikitComp);
}
return $items;
}
return false;
}
示例14: getModules
/**
* Get the modules published in a position
*/
public function getModules($position, $seperator = '', $class = '')
{
// set default
$found = false;
// check if we aleady have these modules loaded
if (isset($this->setModules[$position])) {
$found = true;
} else {
// this is where you want to load your module position
$modules = JModuleHelper::getModules($position);
if ($modules) {
// set the place holder
$this->setModules[$position] = array();
foreach ($modules as $module) {
$this->setModules[$position][] = JModuleHelper::renderModule($module);
}
$found = true;
}
}
// check if modules were found
if ($found && isset($this->setModules[$position]) && CostbenefitprojectionHelper::checkArray($this->setModules[$position])) {
// set class
if (CostbenefitprojectionHelper::checkString($class)) {
$class = ' class="' . $class . '" ';
}
// set seperating return values
switch ($seperator) {
case 'none':
return implode('', $this->setModules[$position]);
break;
case 'div':
return '<div' . $class . '>' . implode('</div><div' . $class . '>', $this->setModules[$position]) . '</div>';
break;
case 'list':
return '<ul' . $class . '><li>' . implode('</li><li>', $this->setModules[$position]) . '</li></ul>';
break;
case 'array':
case 'Array':
return $this->setModules[$position];
break;
default:
return implode('<br />', $this->setModules[$position]);
break;
}
}
return false;
}
示例15: getClusterData
public function getClusterData($idName, $cluster)
{
// we first build the json object from the cluster ids, then pass it to the builder
$oject = '';
$oject_table = '';
if (CostbenefitprojectionHelper::isJson($cluster) && CostbenefitprojectionHelper::checkString($idName)) {
$array = json_decode($cluster, true);
// get te set intervention data
$interventions = array();
if (CostbenefitprojectionHelper::checkArray($array)) {
foreach ($array as $intervention) {
$interventions[$intervention] = CostbenefitprojectionHelper::getVar('intervention', $intervention, 'id', 'intervention');
}
}
// sort the data
$bucket = array();
if (CostbenefitprojectionHelper::checkArray($interventions)) {
foreach ($interventions as $inter => $set) {
if (CostbenefitprojectionHelper::isJson($set)) {
$set = json_decode($set, true);
if (CostbenefitprojectionHelper::checkArray($set)) {
foreach ($set as $option => $values) {
foreach ($values as $nr => $value) {
$bucket[$inter][$nr][$option] = $value;
}
}
}
}
}
}
// combine the data
$combine = array();
if (CostbenefitprojectionHelper::checkArray($bucket)) {
foreach ($bucket as $pool) {
if (CostbenefitprojectionHelper::checkArray($pool)) {
foreach ($pool as $headers) {
if (CostbenefitprojectionHelper::checkArray($headers)) {
// check if this cause is already targeted
if (isset($combine[$headers['causerisk']])) {
// combine
$temp = $combine[$headers['causerisk']];
$temp['cpe'] = $this->combineValues($temp['cpe'], $headers['cpe']);
$temp['mbr'] = $this->combineValues($temp['mbr'], $headers['mbr']);
$temp['mtr'] = $this->combineValues($temp['mtr'], $headers['mtr']);
// update the data
$combine[$headers['causerisk']] = $temp;
} else {
// set for first time
$combine[$headers['causerisk']] = array('cpe' => $headers['cpe'], 'mbr' => $headers['mbr'], 'mtr' => $headers['mtr']);
}
}
}
}
}
}
// setup the object
if (CostbenefitprojectionHelper::checkArray($combine)) {
$oject = array();
foreach ($combine as $causerisk => $vals) {
if (CostbenefitprojectionHelper::checkArray($vals)) {
$oject['causerisk'][] = $causerisk;
foreach ($vals as $header => $v) {
// set placeholder
$oject[$header][] = $v;
}
}
}
// done at last
$oject = json_encode($oject);
}
}
// return the table and values
return array('table' => $this->getInterventionBuildTable($idName, $oject, 'ja'), 'values' => $oject);
}