本文整理汇总了PHP中Helper类的典型用法代码示例。如果您正苦于以下问题:PHP Helper类的具体用法?PHP Helper怎么用?PHP Helper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Helper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public function test(CqmPatient $patient, $beginDate, $endDate)
{
// See if user has been a tobacco user before or simultaneosly to the encounter within two years (24 months)
$date_array = array();
foreach ($this->getApplicableEncounters() as $encType) {
$dates = Helper::fetchEncounterDates($encType, $patient, $beginDate, $endDate);
$date_array = array_merge($date_array, $dates);
}
// sort array to get the most recent encounter first
$date_array = array_unique($date_array);
rsort($date_array);
// go through each unique date from most recent
foreach ($date_array as $date) {
// encounters time stamp is always 00:00:00, so change it to 23:59:59 or 00:00:00 as applicable
$date = date('Y-m-d 23:59:59', strtotime($date));
$beginMinus24Months = strtotime('-24 month', strtotime($date));
$beginMinus24Months = date('Y-m-d 00:00:00', $beginMinus24Months);
// this is basically a check to see if the patient is an reported as an active smoker on their last encounter
if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_USER, $patient, $beginMinus24Months, $date)) {
return true;
} else {
if (Helper::check(ClinicalType::CHARACTERISTIC, Characteristic::TOBACCO_NON_USER, $patient, $beginMinus24Months, $date)) {
return false;
} else {
// nothing reported during this date period, so move on to next encounter
}
}
}
return false;
}
示例2: checkFunctionSummery
/**
*Function returns nothing ,checks whether user has added anything in cart or not.
*@param string $email
*@param string $pass
*@var object
*@name $field
*@name $table
*/
public function checkFunctionSummery($email, $pass)
{
$obj = new Helper("ecomm");
if (isset($email) && isset($pass)) {
$field = "user_id";
$table = "user";
$condition = " email_id='{$email}' AND password='{$pass}' ";
$result = $obj->read_record($field, $table, $condition);
if (is_array($result)) {
foreach ($result as $row) {
if ($_SESSION['user'] == $row['user_id']) {
header("Location: OrderSummaryPageIncluded.php");
}
}
} else {
//If the login credentials doesn't match, he will be shown with an error message.
echo "Invalid Login Credentials.";
header("Location: LoginPageIncluded.php");
}
} else {
//If the login credentials doesn't match, he will be shown with an error message.
echo "Invalid Login Credentials.";
header("Location: LoginPageIncluded.php");
}
}
示例3: peoplefindAction
public function peoplefindAction()
{
$people = new Peoplefind();
# die ("....");
$converted = false;
if (!empty($_GET)) {
$_POST = $_GET;
$converted = true;
}
if (!$converted && (!empty($_POST) || !empty($_GET))) {
$params_query = http_build_query($_POST);
header("Location:http://{$_SERVER['HTTP_HOST']}/peoplefind/peoplefind?{$params_query}");
}
$param = $_GET;
if (empty($_GET)) {
$param = $_POST;
}
$search = $people->peoplesearch($param);
$helper = new Helper();
$cohort = $helper->getCohorts();
$cadre = $helper->getCadres();
$institution = $helper->getInstitutions(false);
$facility = $helper->getFacilities();
$this->view->assign('title', $this->view->translation['Application Name']);
$this->view->assign('cohort', $cohort);
$this->view->assign('cadre', $cadre);
$this->view->assign('institution', $institution);
$this->view->assign('facility', $facility);
$this->view->assign('getpeople', $search);
}
示例4: peopleaddAction
public function peopleaddAction()
{
//locations
if (count($_POST) > 0) {
if (isset($_POST['addpeople'])) {
$peopleadd = new PeopleAdd();
# TRIGGERS ADDING PERSON
$tutorid = $peopleadd->addTutor($_POST);
switch ($_POST['type']) {
case "tutor":
$this->_redirect(Settings::$COUNTRY_BASE_URL . "/tutoredit/tutoredit/id/" . $tutorid);
break;
}
}
exit;
}
$this->viewAssignEscaped('locations', Location::getAll());
$this->view->assign('action', '../studentedit/studentedit/');
$this->view->assign('title', $this->view->translation['Application Name']);
$persontitle = new Peopleadd();
$result = $persontitle->Peopletitle($fetchtitle);
$this->view->assign('fetchtitle', $result);
// FOr Facility
$faclilityttitle = new Peopleadd();
$result = $faclilityttitle->PeopleFacility($fetchfacility);
$this->view->assign('fetchfacility', $result);
$citylist = new Peopleadd();
$result = $citylist->PeopleCity($citylist);
$this->view->assign('fetchcity', $result);
# CREATING HELPER
$helper = new Helper();
$this->view->assign('institutions', $helper->getInstitutions(false));
}
示例5: __construct
public function __construct()
{
$helper = new Helper();
// Why doesn't it resolve the ::class in the Service const BAR?
$thisShouldBeBar = $helper->newInstanceArgs(Service::BAR);
$thisOneWorks = $helper->newInstanceArgs(Bar::class);
}
示例6: edit_article_validation
function edit_article_validation()
{
global $edit_article_validation;
$helper_obj = new Helper();
$output = "<script>\$(document).ready(function(){\n \$('#edit_video').validate(\n {\n 'rules': " . json_encode($edit_article_validation) . ",\n 'messages':{\n 'title_updated' :{\n 'required': '" . $helper_obj->t('This field is required') . "' \n },\n 'description_updated' :{\n 'required': '" . $helper_obj->t('This field is required') . "' \n },\n 'edit_category' :{\n 'required': '" . $helper_obj->t('This field is required') . "' \n },\n 'edit_pgrate' :{\n 'required': '" . $helper_obj->t('This field is required') . "' \n },\n }\n }); \n });</script>";
return $output;
}
示例7: discard
public function discard($index)
{
$card = $this->hand[$index];
$helper = new Helper();
$newHand = $helper->moveCardToLast($this->hand, $index);
$this->hand = $newHand;
return array_pop($this->hand);
}
示例8: __construct
function __construct($id)
{
global $db;
$sql = 'SELECT * FROM account WHERE uid = ?';
$pdo = $db->prepare($sql);
$pdo->bindParam(1, $id, PDO::PARAM_INT);
if (is_numeric($id) && $pdo->execute()) {
if ($pdo->rowCount() > 0) {
$data = $pdo->fetch(PDO::FETCH_ASSOC);
$this->id = $data['uid'];
$this->clan = new Clan($data['clan_id']);
$this->name = $data['name'];
$this->locker = $data['locker'];
$this->score = $data['score'];
$this->kills = $data['kills'];
$this->death = $data['deaths'];
$this->player_since = strtotime($data['first_connect_at']);
$this->last_seen = strtotime($data['last_disconnect_at']);
$this->total_connections = $data['total_connections'];
$sql = 'SELECT * FROM player WHERE account_uid = ?';
$pdo = $db->prepare($sql);
$pdo->bindParam(1, $id, PDO::PARAM_INT);
if ($pdo->execute()) {
foreach ($pdo->fetchAll(PDO::FETCH_ASSOC) as $pl) {
$this->players[] = $pl['id'];
$this->money = $pl['money'];
}
}
$sql = 'SELECT * FROM player_history WHERE account_uid = ?';
$pdo = $db->prepare($sql);
$pdo->bindParam(1, $id, PDO::PARAM_INT);
if ($pdo->execute()) {
$this->players_dead = $pdo->rowCount();
}
$sql = 'SELECT * FROM construction WHERE account_uid = ?';
$pdo = $db->prepare($sql);
$pdo->bindParam(1, $id, PDO::PARAM_INT);
if ($pdo->execute()) {
$this->buildings = $pdo->rowCount();
}
$sql = 'SELECT * FROM vehicle WHERE account_uid = ?';
$pdo = $db->prepare($sql);
$pdo->bindParam(1, $id, PDO::PARAM_INT);
if ($pdo->execute()) {
foreach ($pdo->fetchAll(PDO::FETCH_ASSOC) as $data) {
$this->vehicle[] = $data['id'];
}
}
$helper = new Helper();
$this->territory = $helper->getTerritoryForUser($this->id);
} else {
print_r($pdo->errorInfo());
trigger_error('Wrong ID or ID not Found!', E_USER_ERROR);
}
} else {
trigger_error('Execution failed. DB Error? ' . $id, E_USER_ERROR);
}
}
示例9: hookParseTemplate
/**
* Inject the helper for the frontend templates.
*
* @param \Template $template The template being parsed.
*
* @return void
*/
public function hookParseTemplate(\Template $template)
{
if (substr($template->getName(), 0, 3) === 'fe_') {
$helper = new Helper($template);
$template->flexibleSections = function ($position, $template = 'block_sections') use($helper) {
echo $helper->getCustomSections($position, $template);
};
$template->getFlexibleSectionsHelper = function () use($helper) {
return $helper;
};
}
}
示例10: peopleAction
public function peopleAction()
{
$helper = new Helper();
$cohort = $helper->getCohorts();
$cadre = $helper->getCadres();
$institution = $helper->getInstitutions(false);
$facility = $helper->getFacilities();
$this->view->assign('title', $this->view->translation['Application Name']);
$this->view->assign('cohort', $cohort);
$this->view->assign('cadre', $cadre);
$this->view->assign('institution', $institution);
$this->view->assign('facility', $facility);
}
示例11: bar_task
public function bar_task($id)
{
$help = new Helper();
$issues = $help->searchIssues($id);
//foreach ($issues as $issue) {
# code...
// $issue->id
//}
//$iteration = Iterations::findOrFail($id);
//$idTmp = $iteration->id;
// $issues = Issue::where('iterationid','=', $idTmp)->get();
//$issues = $iteration->issues;
//$countIssues = sizeof($issues);
$countIssues = 0;
$dataEstimatedTime = array();
$dataRealTime = array();
$dataIterationName = array();
$countTODO = 0;
$countDOING = 0;
$countDONE = 0;
//$string_iterations = implode(";", $iterations);
JpGraph\JpGraph::load();
JpGraph\JpGraph::module('bar');
JpGraph\JpGraph::module('line');
$datay = array(12, 8, 19, 3, 10, 5);
// Create the graph. These two calls are always required
$graph = new Graph(300, 200);
$graph->SetScale('textlin');
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->SetMargin(40, 30, 20, 40);
// Create a bar pot
$bplot = new BarPlot($datay);
// Adjust fill color
$bplot->SetFillColor('orange');
$graph->Add($bplot);
// Setup the titles
$graph->title->Set('A basic bar graph ');
$graph->xaxis->title->Set('X-title');
$graph->yaxis->title->Set('Y-title');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
//$graph->Stroke();
//$response = Response::make(
// $graph->Stroke()
//);
// $response->header('content-type', 'image/png');
// return $response;
}
示例12: displayAjaxCategoriesList
/**
* Listing ajax des catégories
*/
public function displayAjaxCategoriesList()
{
//Insertion des styles admin nécessaire à l'affichage des actions ajax
foreach ($this->css_files as $css_key => $css_type) {
echo '<link rel="stylesheet" type="text/css" href="' . $css_key . '" type="' . $css_type . '"/>';
}
//Géneration du tree des catégories
if (_PS_VERSION_ < '1.6') {
$categoryTree = new Helper();
echo $categoryTree->renderCategoryTree(2, array(), 'id-category-for-insert');
} else {
$categoryTree = new HelperTreeCategories('categories-tree', $this->l('Check the category to display the link'));
echo $categoryTree->setAttribute()->setInputName('id-category-for-insert')->render();
}
}
示例13: ObjectName
public function ObjectName($option = null)
{
if ($option != null && is_array($option)) {
$objectType = $option['IntObjectType'];
if (array_key_exists('Facility', $option)) {
$facility = $option['Facility'];
$facility_id = $facility['id'];
} else {
$facility_id = $this->ID;
}
if (array_key_exists('ExtensionPhaseType', $option)) {
$phaseType = $option['ExtensionPhaseType'];
$phaseTypeId = $phaseType['id'];
} else {
if (array_key_exists('CodeProductType', $option)) {
$phaseType = $option['CodeProductType'];
$phaseTypeId = $phaseType['id'];
} else {
$phaseTypeId = 0;
}
}
$mdlName = $objectType['name'];
$mdl = \Helper::getModelName($mdlName);
return $mdl::getEntries($facility_id, $phaseTypeId);
}
return null;
}
示例14: test
public function test(CqmPatient $patient, $beginDate, $endDate)
{
// Flow of control loop
$return = false;
do {
// See if BMI has been recorded between >=22kg/m2 and <30kg/m2 6 months before, or simultanious to the encounter
$query = "SELECT form_vitals.BMI " . "FROM `form_vitals` " . "LEFT JOIN `form_encounter` " . "ON ( form_vitals.pid = form_encounter.pid ) " . "LEFT JOIN `enc_category_map` " . "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . "WHERE form_vitals.BMI IS NOT NULL " . "AND form_vitals.BMI IS NOT NULL " . "AND form_vitals.pid = ? AND form_vitals.BMI >= 22 AND form_vitals.BMI < 30 " . "AND DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) " . "AND DATE( form_vitals.date ) <= DATE( form_encounter.date ) " . "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )";
$res = sqlStatement($query, array($patient->id));
$number = sqlNumRows($res);
if ($number >= 1) {
$return = true;
break;
}
// See if BMI has been recorded >=30kg/m2 6 months before, or simultanious to the encounter
// AND ÒCare goal: follow-up plan BMI managementÓ OR ÒCommunication provider to provider: dietary consultation orderÓ
$query = "SELECT form_vitals.BMI " . "FROM `form_vitals` " . "LEFT JOIN `form_encounter` " . "ON ( form_vitals.pid = form_encounter.pid ) " . "LEFT JOIN `enc_category_map` " . "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . "WHERE form_vitals.BMI IS NOT NULL " . "AND form_vitals.BMI IS NOT NULL " . "AND form_vitals.pid = ? AND form_vitals.BMI >= 30 " . "AND ( DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) ) " . "AND ( DATE( form_vitals.date ) <= DATE( form_encounter.date ) ) " . "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )";
$res = sqlStatement($query, array($patient->id));
$number = sqlNumRows($res);
if ($number >= 1 && (Helper::check(ClinicalType::CARE_GOAL, CareGoal::FOLLOW_UP_PLAN_BMI_MGMT, $patient) || Helper::check(ClinicalType::COMMUNICATION, Communication::DIET_CNSLT, $patient))) {
$return = true;
break;
}
// See if BMI has been recorded <22kg/m2 6 months before, or simultanious to the encounter
// AND ÒCare goal: follow-up plan BMI managementÓ OR ÒCommunication provider to provider: dietary consultation orderÓ
$query = "SELECT form_vitals.BMI " . "FROM `form_vitals` " . "LEFT JOIN `form_encounter` " . "ON ( form_vitals.pid = form_encounter.pid ) " . "LEFT JOIN `enc_category_map` " . "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . "WHERE form_vitals.BMI IS NOT NULL " . "AND form_vitals.BMI IS NOT NULL " . "AND form_vitals.pid = ? AND form_vitals.BMI < 22 " . "AND ( DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) ) " . "AND ( DATE( form_vitals.date ) <= DATE( form_encounter.date ) ) " . "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )";
$res = sqlStatement($query, array($patient->id));
$number = sqlNumRows($res);
if ($number >= 1 && (Helper::check(ClinicalType::CARE_GOAL, CareGoal::FOLLOW_UP_PLAN_BMI_MGMT, $patient) || Helper::check(ClinicalType::COMMUNICATION, Communication::DIET_CNSLT, $patient))) {
$return = true;
break;
}
} while (false);
return $return;
}
示例15: actionIndex
/**
* 程序文件列表
*/
public function actionIndex()
{
if (isset($_POST['id'])) {
$files = $_POST['id'];
if ($files) {
//提交打包
$zip = new ZipArchive();
$name = 'yiifcmsBAK_' . date('YmdHis', time()) . '.zip';
$zipname = WWWPATH . '/' . $name;
//创建一个空的zip文件
if ($zip->open($zipname, ZipArchive::OVERWRITE)) {
foreach ((array) $files as $file) {
if (is_dir($file)) {
//递归检索文件
$allfiles = Helper::scanfDir($file, true);
foreach ((array) $allfiles['files'] as $v) {
$zip->addFile(WWWPATH . '/' . $v, $v);
}
} else {
$zip->addFile(WWWPATH . '/' . $file, $file);
}
}
$zip->close();
//开始下载
Yii::app()->request->sendFile($name, file_get_contents($zipname), '', false);
//下载完成后要进行删除
@unlink($zipname);
} else {
throw new CHttpException('404', 'Failed');
}
}
} else {
$files = Helper::scanfDir(WWWPATH);
asort($files['dirs']);
asort($files['files']);
$files = array_merge($files['dirs'], $files['files']);
$listfiles = array();
foreach ($files as $file) {
$tmpfilename = explode('/', $file);
$filename = end($tmpfilename);
if (is_dir($file)) {
$allfiles = Helper::scanfDir($file, true);
if ($allfiles['files']) {
$filesize = 0;
foreach ((array) $allfiles['files'] as $val) {
$filesize += filesize($val);
}
}
$listfiles[$filename]['type'] = 'dir';
} else {
$filesize = filesize($file);
$listfiles[$filename]['type'] = 'file';
}
$listfiles[$filename]['id'] = $filename;
$listfiles[$filename]['size'] = Helper::byteFormat($filesize);
$listfiles[$filename]['update_time'] = filemtime($filename);
}
}
$this->render('index', array('listfiles' => $listfiles));
}