Author: Clemens John (clemens-john@gmx.de)
 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);
 }
 /**
  *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='******' ";
         $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");
     }
 }
Beispiel #3
0
 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);
 }
 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));
 }
Beispiel #5
0
 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;
 }
Beispiel #6
0
 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);
 }
 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);
     }
 }
 /**
  * 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;
         };
     }
 }
 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);
 }
 /**
  * Shorten text to specified length
  *
  * @param $length
  *
  * @return string Shortened text or empty if incorrect input data was supplied
  */
 public function shortenText($length)
 {
     if (!$this->inputValid) {
         return '';
     }
     if ($length >= $this->textLength) {
         $this->shortenedText = $this->text;
     } else {
         $this->buildShortenedText($length);
     }
     $this->shortenedText = $this->helper->addDelimiters($this->shortenedText, $this->delimiter);
     return $this->shortenedText;
 }
 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;
 }
 /**
  * @covers \Migration\Step\Eav\InitialData::Init
  * @covers \Migration\Step\Eav\InitialData::initAttributes
  * @covers \Migration\Step\Eav\InitialData::initAttributeSets
  * @covers \Migration\Step\Eav\InitialData::initAttributeGroups
  * @covers \Migration\Step\Eav\InitialData::getAttributes
  * @covers \Migration\Step\Eav\InitialData::getAttributeSets
  * @covers \Migration\Step\Eav\InitialData::getAttributeGroups
  * @return void
  */
 public function testInit()
 {
     $dataAttributes = ['source' => ['id_1' => 'value_1', 'id_2' => 'value_2'], 'dest' => ['id_1' => 'value_1', 'id_2' => 'value_2']];
     $attributeSets = ['attr_set_1', 'attr_set_2'];
     $attributeGroups = ['attr_group_1', 'attr_group_2'];
     $this->helper->expects($this->once())->method('getSourceRecords')->willReturnMap([['eav_attribute', ['attribute_id'], $dataAttributes['source']]]);
     $this->helper->expects($this->any())->method('getDestinationRecords')->willReturnMap([['eav_attribute', ['entity_type_id', 'attribute_code'], $dataAttributes['dest']], ['eav_attribute_set', ['attribute_set_id'], $attributeSets], ['eav_attribute_group', ['attribute_set_id', 'attribute_group_name'], $attributeGroups]]);
     $this->initialData->init();
     foreach ($dataAttributes as $resourceType => $resourceData) {
         $this->assertEquals($resourceData, $this->initialData->getAttributes($resourceType));
     }
     $this->assertEquals($attributeSets, $this->initialData->getAttributeSets('dest'));
     $this->assertEquals($attributeGroups, $this->initialData->getAttributeGroups('dest'));
 }
 /**
  * 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();
     }
 }
Beispiel #14
0
 public function query($postdata)
 {
     if ($this->user->getClass() < User::CLASS_ADMIN) {
         throw new Exception(L::get("PERMISSION_DENIED"), 401);
     }
     $limit = (int) $postdata["limit"] ?: 25;
     $index = (int) $postdata["index"] ?: 0;
     $search = $postdata["search"] ?: "";
     $where = "";
     if (strlen($search) > 0) {
         $searchWords = Helper::searchTextToWordParams($search);
         $where = "WHERE MATCH (adminlog.search_text) AGAINST (" . $this->db->quote($searchWords) . " IN BOOLEAN MODE)";
     }
     $sth = $this->db->query("SELECT COUNT(*) FROM adminlog " . $where);
     $res = $sth->fetch();
     $totalCount = $res[0];
     $sth = $this->db->prepare("SELECT adminlog.added, adminlog.id AS aid, adminlog.txt, users.id, users.username FROM adminlog LEFT JOIN users ON adminlog.userid = users.id " . $where . " ORDER BY adminlog.id DESC LIMIT ?, ?");
     $sth->bindParam(1, $index, PDO::PARAM_INT);
     $sth->bindParam(2, $limit, PDO::PARAM_INT);
     $sth->execute();
     $result = array();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $r = array();
         $r["id"] = $row["aid"];
         $r["added"] = $row["added"];
         $r["txt"] = str_replace("{{username}}", "[url=/user/" . $row["id"] . "/" . $row["username"] . "][b]" . $row["username"] . "[/b][/url]", $row["txt"]);
         array_push($result, $r);
     }
     return array($result, $totalCount);
 }
Beispiel #15
0
 /**
  * Start a editing session or return an existing one
  * @param string $uid of the user starting a session
  * @param \OCA\Documents\File $file - file object
  * @return array
  * @throws \Exception
  */
 public static function start($uid, $file)
 {
     // Create a directory to store genesis
     $genesis = new Genesis($file);
     list($ownerView, $path) = $file->getOwnerViewAndPath();
     $oldSession = new Db_Session();
     $oldSession->loadBy('file_id', $file->getFileId());
     //If there is no existing session we need to start a new one
     if (!$oldSession->hasData()) {
         $newSession = new Db_Session(array($genesis->getPath(), $genesis->getHash(), $file->getOwner(), $file->getFileId()));
         if (!$newSession->insert()) {
             throw new \Exception('Failed to add session into database');
         }
     }
     $sessionData = $oldSession->loadBy('file_id', $file->getFileId())->getData();
     $memberColor = Helper::getMemberColor($uid);
     $member = new Db_Member(array($sessionData['es_id'], $uid, $memberColor, time(), intval($file->isPublicShare()), $file->getToken()));
     if ($member->insert()) {
         // Do we have OC_Avatar in out disposal?
         if (!class_exists('\\OC_Avatar') || \OC_Config::getValue('enable_avatars', true) !== true) {
             $imageUrl = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==';
         } else {
             $imageUrl = $uid;
         }
         $displayName = $file->isPublicShare() ? $uid . ' ' . Db_Member::getGuestPostfix() : \OCP\User::getDisplayName($uid);
         $sessionData['member_id'] = (string) $member->getLastInsertId();
         $op = new Db_Op();
         $op->addMember($sessionData['es_id'], $sessionData['member_id'], $displayName, $memberColor, $imageUrl);
     } else {
         throw new \Exception('Failed to add member into database');
     }
     $sessionData['title'] = basename($path);
     $sessionData['permissions'] = $ownerView->getFilePermissions($path);
     return $sessionData;
 }
Beispiel #16
0
 public function run()
 {
     //限制下载频率
     $cookie = Yii::app()->request->getCookies();
     $id = Yii::app()->request->getParam('id');
     $cookie_key = 'DL' . $id . 'TIMES';
     if (isset($cookie[$cookie_key]) && $cookie[$cookie_key]->value) {
         throw new CHttpException(404, Yii::t('common', 'Access frequency too fast'));
     }
     $video = Video::model()->findByPk($id);
     if ($video) {
         $file = Helper::convertChineseName(ROOT_PATH . '/' . $video->video_file);
         if ($video->video_file && file_exists($file)) {
             $filename = pathinfo($file, PATHINFO_BASENAME);
             //更新下载次数
             $video->updateCounters(array('down_count' => 1), 'id=:id', array('id' => $id));
             //存储下载cookie次数
             unset($cookie[$cookie_key]);
             $down = 1;
             $cookie = new CHttpCookie($cookie_key, $down);
             $cookie->expire = time() + 20;
             //20秒之后可以再次下载
             Yii::app()->request->cookies[$cookie_key] = $cookie;
             //开始下载
             Yii::app()->request->sendFile($filename, file_get_contents($file));
             exit;
         } else {
             throw new CHttpException(404, Yii::t('common', 'Source Is Not Found'));
         }
     } else {
         throw new CHttpException(404, Yii::t('common', 'Source Is Not Found'));
     }
 }
Beispiel #17
0
 public function __construct(View $view, $settings = array())
 {
     parent::__construct($view, $settings);
     foreach ($this->uses as $model) {
         $this->{$model} = ClassRegistry::init($model);
     }
 }
Beispiel #18
0
 function popup_elements()
 {
     $animation_speed = Helper::get_animation_speed_data();
     $animation_direction = Helper::get_animation_direction_data();
     $animation_type = Helper::get_animation_type_data();
     $this->config['subElements'] = array(array("name" => __('Alert Type', 'fusion-core'), "desc" => __('Select the type of alert message. Choose custom for advanced color options below.', 'fusion-core'), "id" => "fusion_type", "type" => ElementTypeEnum::SELECT, "value" => "general", "allowedValues" => array('general' => __('General', 'fusion-core'), 'error' => __('Error', 'fusion-core'), 'success' => __('Success', 'fusion-core'), 'notice' => __('Notice', 'fusion-core'), 'custom' => __('Custom', 'fusion-core'))), array("name" => __('Accent Color', 'fusion-core'), "desc" => __('Custom setting only. Set the border, text and icon color for custom alert boxes.', 'fusion-core'), "id" => "fusion_accentcolor", "type" => ElementTypeEnum::COLOR, "value" => ""), array("name" => __('Background Color', 'fusion-core'), "desc" => __('Custom setting only. Set the background color for custom alert boxes.', 'fusion-core'), "id" => "fusion_backgroundcolor", "type" => ElementTypeEnum::COLOR, "value" => ""), array("name" => __('Border Width', 'fusion-core'), "desc" => __('Custom setting. For custom alert boxes. In pixels (px), ex: 1px.', 'fusion-core'), "id" => "fusion_bordersize", "type" => ElementTypeEnum::INPUT, "value" => "1px"), array("name" => __('Select Custom Icon', 'fusion-core'), "desc" => __('Custom setting only. Click an icon to select, click again to deselect', 'fusion-core'), "id" => "icon", "type" => ElementTypeEnum::ICON_BOX, "value" => "", "list" => Helper::GET_ICONS_LIST()), array("name" => __('Box Shadow', 'fusion-core'), "desc" => __('Display a box shadow below the alert box.', 'fusion-core'), "id" => "fusion_boxshadow", "type" => ElementTypeEnum::SELECT, "value" => "yes", "allowedValues" => array('yes' => __('Yes', 'fusion-core'), 'no' => __('No', 'fusion-core'))), array("name" => __('Alert Content', 'fusion-core'), "desc" => __('Insert the alert\'s content', 'fusion-core'), "id" => "fusion_content_wp", "type" => ElementTypeEnum::HTML_EDITOR, "value" => __('Your Content Goes Here', 'fusion-core')), array("name" => __('Animation Type', 'fusion-core'), "desc" => __('Select the type on animation to use on the shortcode', 'fusion-core'), "id" => "fusion_animation_type", "type" => ElementTypeEnum::SELECT, "value" => "", "allowedValues" => $animation_type), array("name" => __('Direction of Animation', 'fusion-core'), "desc" => __('Select the incoming direction for the animation', 'fusion-core'), "id" => "fusion_animation_direction", "type" => ElementTypeEnum::SELECT, "value" => "left", "allowedValues" => $animation_direction), array("name" => __('Speed of Animation', 'fusion-core'), "desc" => __('Type in speed of animation in seconds (0.1 - 1)', 'fusion-core'), "id" => "fusion_animation_speed", "type" => ElementTypeEnum::SELECT, "value" => "", "allowedValues" => $animation_speed), array("name" => __('CSS Class', 'fusion-core'), "desc" => __('Add a class to the wrapping HTML element.', 'fusion-core'), "id" => "fusion_class", "type" => ElementTypeEnum::INPUT, "value" => ""), array("name" => __('CSS ID', 'fusion-core'), "desc" => __('Add an ID to the wrapping HTML element.', 'fusion-core'), "id" => "fusion_id", "type" => ElementTypeEnum::INPUT, "value" => ""));
 }
Beispiel #19
0
 public static function makeFileName(\Freetrix\Iblock\InheritedProperty\BaseTemplate $ipropTemplates, $templateName, $arFields, $arFile)
 {
     if (preg_match("/^(.+)(\\.[a-zA-Z0-9]+)\$/", $arFile["name"], $fileName)) {
         if (!isset($arFields["IPROPERTY_TEMPLATES"]) || $arFields["IPROPERTY_TEMPLATES"][$templateName] == "") {
             $templates = $ipropTemplates->findTemplates();
             $TEMPLATE = $templates[$templateName]["TEMPLATE"];
         } else {
             $TEMPLATE = $arFields["IPROPERTY_TEMPLATES"][$templateName];
         }
         if ($TEMPLATE != "") {
             list($template, $modifiers) = Helper::splitTemplate($TEMPLATE);
             if ($template != "") {
                 $values = $ipropTemplates->getValuesEntity();
                 $entity = $values->createTemplateEntity();
                 $entity->setFields($arFields);
                 return \Freetrix\Iblock\Template\Engine::process($entity, $TEMPLATE) . $fileName[2];
             } elseif ($modifiers != "") {
                 $simpleTemplate = new NodeRoot();
                 $simpleTemplate->addChild(new NodeText($fileName[1]));
                 $simpleTemplate->setModifiers($modifiers);
                 $baseEntity = new Entity\Base(0);
                 return $simpleTemplate->process($baseEntity) . $fileName[2];
             }
         }
     }
     return $arFile["name"];
 }
Beispiel #20
0
 public function _initCore()
 {
     define('TB_PK', 'id');
     // 表的主键, 用于 SelectByID 等
     define('TB_PREFIX', 'zt_');
     // 表前缀
     define('APP_NAME', 'YOF-DEMO');
     define('LIB_PATH', APP_PATH . '/application/library/');
     define('MODEL_PATH', APP_PATH . '/application/model');
     define('FUNC_PATH', APP_PATH . '/application/function');
     define('ADMIN_PATH', APP_PATH . '/application/modules/Admin');
     // CSS, JS, IMG PATH
     define('CSS_PATH', '/css');
     define('JS_PATH', '/js');
     define('IMG_PATH', '/img');
     // Admin CSS, JS PATH
     define('ADMIN_CSS_PATH', '/admin/css');
     define('ADMIN_JS_PATH', '/admin/js');
     // 设置自动加载的目录
     ini_set('yaf.library', LIB_PATH);
     // 导入 F_Basic.php 与 F_Network.php
     Helper::import('Basic');
     Helper::import('Network');
     Yaf_Loader::import('C_Basic.php');
     Yaf_Loader::import(LIB_PATH . '/yar/Yar_Basic.php');
     // header.html and left.html
     define('HEADER_HTML', APP_PATH . '/public/common/header.html');
     define('LEFT_HTML', APP_PATH . '/public/common/left.html');
     // API KEY for api sign
     define('API_KEY', 'THIS_is_OUR_API_keY');
 }
 public function beforeSave()
 {
     $this->images = str_replace(Helper::rootImg('content'), '', $this->images);
     $this->taxonomy = $this->_taxonomy;
     $this->name = Ucfirst($this->name);
     return true;
 }
Beispiel #22
0
 public static function cleanUp($version)
 {
     if (self::$package) {
         Helper::removeIfExists(self::$package);
     }
     Helper::removeIfExists(self::getPackageDir($version));
 }
Beispiel #23
0
 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;
 }
 public function actionHeadermobile()
 {
     $model = new Form_Headers_Mobile();
     $setting = array();
     foreach (get_object_vars($model) as $key => $null) {
         $setting[$key] = $this->loadSetting($key);
         $model->{$key} = $setting[$key]->option_value;
     }
     if (isset($_POST['Form_Headers_Mobile'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->attributes = $_POST['Form_Headers_Mobile'];
             if ($model->validate()) {
                 foreach (get_object_vars($model) as $key => $null) {
                     $setting[$key]->option_value = str_replace(Helper::rootImg('content'), '', $_POST['Form_Headers_Mobile'][$key]);
                     if (!$setting[$key]->save()) {
                         throw new Exception($setting[$key]->getError('value'));
                     }
                 }
                 $transaction->commit();
                 $message = "<strong>Well done!</strong> You successfully Update Settings";
                 Yii::app()->user->setFlash('info', $message);
                 $this->refresh();
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             $this->refresh();
         }
     }
     $this->render('mobile', compact('model', 'data'));
 }
Beispiel #25
0
 /**
  * 程序文件列表
  */
 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));
 }
Beispiel #26
0
 static function Facebook()
 {
     if (!self::$facebook) {
         self::$facebook = new Facebook(array('appId' => Config::get('facebook.app_id'), 'secret' => Config::get('facebook.secret')));
     }
     return self::$facebook;
 }
Beispiel #27
0
 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;
 }
Beispiel #28
0
 public static function getInstance()
 {
     if (self::$instance === NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Beispiel #29
0
 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;
 }
Beispiel #30
0
 public function _initCore()
 {
     define('TB_PREFIX', 'zt_');
     define('APP_NAME', 'YOF-DEMO');
     define('LIB_PATH', APP_PATH . '/application/library');
     define('MODEL_PATH', APP_PATH . '/application/model');
     define('FUNC_PATH', APP_PATH . '/application/function');
     define('ADMIN_PATH', APP_PATH . '/application/modules/Admin');
     // CSS, JS, IMG PATH
     define('CSS_PATH', '/css');
     define('JS_PATH', '/js');
     define('IMG_PATH', '/img');
     // Admin CSS, JS PATH
     define('ADMIN_CSS_PATH', '/admin/css');
     define('ADMIN_JS_PATH', '/admin/js');
     Yaf_Loader::import('M_Model.pdo.php');
     Yaf_Loader::import('Helper.class.php');
     Helper::import('Basic');
     Helper::import('Network');
     Yaf_Loader::import('C_Basic.php');
     Yaf_Loader::import(LIB_PATH . '/yar/Yar_Basic.php');
     // header.html and left.html
     define('HEADER_HTML', APP_PATH . '/public/common/header.html');
     define('LEFT_HTML', APP_PATH . '/public/common/left.html');
     // API KEY for api sign
     define('API_KEY', 'THIS_is_OUR_API_keY');
 }