public function each(Records $records, Nodes $nodes, callable $callback) : void { if (!$this->externalAddress->isEmpty()) { $record = $records->read($this->externalAddress); $node = $nodes->read($record->nodeAddress()); $node->each($callback); } }
public function actionFile() { $uploadedFile = CUploadedFile::getInstanceByName("import_file"); if (isset($uploadedFile)) { echo "Configure the date and IP"; $csvFile = fopen($uploadedFile->tempName, "r"); $headers = fgetcsv($csvFile); $isFirstRow = true; while (!feof($csvFile)) { if ($isFirstRow) { $isFirstRow = false; continue; } else { /*get out if empty!*/ $curRow = fgetcsv($csvFile); $curRow = preg_replace("/\r(?!\n)/", '', $curRow); if (empty($curRow)) { continue; } $processData = array_flip($headers); $counter = 0; foreach ($processData as $key => $value) { $processData[$key] = $curRow[$value]; } $processData = array_map('utf8_encode', $processData); $newRecord = new Records("old_file"); $newRecord->account_id = intval($uploadedFile->getName()); $newRecord->claimData = json_encode($processData); $newRecord->ip_address = $curRow[2]; //for now $dt = date_create_from_format("m/d/Y H:i", $curRow[1]); // $newRecord->date_created = $dt->format("Y-m-d H:i:s"); // $newRecord->date_updated = $dt->format("Y-m-d H:i:s"); $newRecord->date_created = $dt->format("Y-m-d H:i:s"); $newRecord->date_updated = $dt->format("Y-m-d H:i:s"); $newRecord->other_information = "none"; if (!$newRecord->save()) { Yii::app()->user->setFlash('error', CHtml::errorSummary($newRecord)); } else { Yii::app()->user->setFlash('success', '<strong>Well done!</strong> Data imported.'); } } } } $this->render("import"); }
public function controller($action) { switch ($action) { case 'login': $login = new LoginLogout(); $login->logIn(); break; case 'do-login': $login = new LoginLogout(); $login->doLogin(); break; case 'logout': $login = new LoginLogout(); $login->logOut(); break; case 'list': $records = new Records(); $records->getRecords(); break; case 'view-record': $records = new Records(); $records->getOneRecord(intval($_GET['id'])); break; case 'add-record': $records = new Records(); $records->addRecord(); break; case 'delete-record': $records = new Records(); $records->delRecord(intval($_GET['id'])); break; case 'add-comment': $comment = new Comments(); $comment->addComment(); break; case 'delete-comment': $comment = new Comments(); $comment->delComment(intval($_GET['id'])); break; case 'about': require ROOT . '/views/about.php'; break; default: die("No action"); } }
public function record() { $user = $this->current_user(); $this->load->model('records'); $cond = array('user_id' => $user->id); $records = Records::findOnCond($cond); $data['records'] = $records; $this->loadAll('record', $data); }
public function testRewindCausesANewRequest() { $uri = 'http://localhost'; $args = array('from' => '2012-01-01', 'until' => '2012-01-02', 'set' => 'Dummy'); $n = 8; $responses = array($response = $this->makeDummyResponse($n, 1, false, $args), $response = $this->makeDummyResponse($n, 1, false, $args), $response = $this->makeDummyResponse($n, 1, false, $args)); $http = $this->httpMockListResponse($responses); // $http = $this->httpMockSingleResponse($response); $client = new Client($uri, null, $http); $records = new Records($args['from'], $args['until'], $args['set'], $client); $records->next(); $records->rewind(); $records->next(); $i = 0; foreach ($records as $rec) { $i++; } $this->assertEquals($n, $i); }
public function ret($bid, $rid) { $this->load->model('books'); $book = Books::findByIds($bid); $book->inventory += 1; $book->save(); $this->load->model('records'); $record = Records::findByIds($rid); $record->is_returned = 1; $record->save(); }
function importRecords() { $csvPath = APPLICATION_PATH . "/../data/imports.csv"; $contents = file_get_contents($csvPath); $lines = explode("\n", $contents); $i = 0; $recordsModel = new Records(); foreach ($lines as $line) { if ($i > 0) { $data = explode(",", $line); $substitutesModel = new Substitutes(); $substitute = $substitutesModel->getBySecondaryId($data[13]); $locationsModel = new Locations(); $location = $locationsModel->getByName($data[4]); $nameSegments = explode("|", $data[3]); $lastName = $nameSegments[0]; $firstName = $nameSegments[1]; $employeesModel = new Employees(); $employee = $employeesModel->getByName($firstName, $lastName); if ($data[9] == 'FALSE' || $data[9] == FALSE) { $leaveForm = 0; } else { $leaveForm = 1; } if (!$substitute) { $subid = '129'; } else { $subid = $substitute->id; } $recordData = array('date' => date('Y-m-d', strtotime($data[1])), 'employee' => @$employee->id, 'location' => @$location->id, 'substitute' => $subid, 'reason' => $data[6], 'notes' => $data[7], 'percent' => str_replace("%", "", $data[8]), 'leave_form' => $leaveForm, 'user' => 6, 'acct' => $data[14]); try { $recordsModel->insert($recordData); } catch (Exception $e) { echo $e->getMessage(); } print_r($recordData); } $i++; } }
public function actionIndex($accountId) { Yii::import("application.models.*"); $criteria = new CDbCriteria(); $criteria->compare('account_id', $account_id); $records = Records::model()->findAll(); foreach ($records as $value) { $dataArr = json_decode($value->claimData, true); if (empty($dataArr['Title']) || empty($dataArr['Firstname'])) { echo "{$value->record_id} \n "; } } }
private function retrieveDataRecords() { $records = null; /*using export type specified above*/ if ($this->exportType === 'all') { $criteria = new CDbCriteria(); $criteria->compare("account_id", $this->model->account_id); $criteria->order = "date_created DESC"; $criteria->distinct = true; $records = Records::model()->findAll($criteria); } else { if ($this->exportType === 'this week') { $criteria = new CDbCriteria(); $criteria->compare("account_id", $this->model->account_id); $startingDate = date("Y-m-d 12:00:00", strtotime('friday last week')); $endDate = date("Y-m-d 23:59:00", strtotime('friday this week')); $criteria->addBetweenCondition("t.date_created", $startingDate, $endDate); $criteria->order = "date_created DESC"; $criteria->distinct = true; $records = Records::model()->findAll($criteria); } else { if ($this->exportType === 'today') { $criteria = new CDbCriteria(); $criteria->compare("account_id", $_REQUEST['accountID']); $criteria->addCondition("date(date_created) = date(now())"); $criteria->order = "date_created DESC"; //$criteria->group = "ip_address"; $criteria->distinct = true; $records = Records::model()->findAll($criteria); } else { if ($this->exportType === 'range') { /*get claims between */ $criteria = new CDbCriteria(); $dateFrom = DateTime::createFromFormat("m/d/Y", $this->configurations['dateFrom']); $dateTo = DateTime::createFromFormat("m/d/Y", $this->configurations['dateTo']); $dateFromStr = $dateFrom->format('Y-m-d'); $dateToStr = $dateTo->format('Y-m-d'); $criteria->compare("account_id", $this->model->account_id); $criteria->addBetweenCondition('date_created', $dateFromStr, $dateToStr); $criteria->order = "date_created DESC"; $criteria->distinct = true; $records = Records::model()->findAll($criteria); } } } } return $records; }
public function download() { $fileName = $this->model->claimAccountName . ' - ' . date("Y-m-d") . '-All-entries'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"{$fileName}.csv\";"); header("Content-Transfer-Encoding: binary"); $criteria = new CDbCriteria(); $criteria->compare("account_id", $this->model->account_id); $criteria->order = "date_created DESC"; $criteria->distinct = true; $records = Records::model()->findAll($criteria); $isFirst = true; foreach ($records as $curRecord) { $data = json_decode($curRecord->claimData, true); $rowData = ""; $allowPrint = true; if ($isFirst) { //print heads $headers = ""; $keys = array_keys($data); $headers = implode(",", $keys) . "\n"; echo $headers; $isFirst = false; } /*check if mobile number exists at blacklist mobile nums*/ $mobileNumMatch = preg_grep('/0?7\\d{9}/', $data); if (count($mobileNumMatch) > 0) { $mobileNumContainer = array_values($mobileNumMatch)[0]; $criteria = new CDbCriteria(); $criteria->compare('mobile_number', $mobileNumContainer); $allowPrint = !BlackListedMobile::model()->exists($criteria); } if ($allowPrint) { foreach ($data as $curRowData) { $rowData = $rowData . "\"{$curRowData}\","; } } $rowData = str_replace(chr(194), " ", $rowData); //prepare data if ($allowPrint) { echo $rowData . "\n"; } } }
public static function applyFilteringLogic($logic, $records = array(), $project_id = null) { // Skip this if no filtering will be performed if ($logic == '') { return false; } // Get or create $Proj object if (is_numeric($project_id)) { // Instantiate object containing all project information // This only occurs when calling getData for a project in a plugin in another project's context $Proj = new Project($project_id); } else { // Set global var global $Proj; } // Place record list in array $records_filtered = array(); // Parse the label to pull out the events/fields used therein $fields = array_keys(getBracketedFields($logic, true, true, false)); // If no fields were found in string, then return the label as-is if (empty($fields)) { return false; } // Instantiate logic parse $parser = new LogicParser(); // Check syntax of logic string: If there is an issue in the logic, then return false and stop processing // if (!LogicTester::isValid($logic)) return false; // Loop through fields, and if is longitudinal with prepended event names, separate out those with non-prepended fields $events = array(); $fields_classic = array(); $fields_no_events = array(); foreach ($fields as $this_key => $this_field) { // If longitudinal with a dot, parse it out and put unique event name in $events array if (strpos($this_field, '.') !== false) { // Separate event from field list($this_event, $this_field) = explode(".", $this_field, 2); // Add field to fields_no_events array $fields_no_events[] = $this_field; // Put event in $events array $this_event_id = $Proj->getEventIdUsingUniqueEventName($this_event); if (!isset($events[$this_event_id])) { $events[$this_event_id] = $this_event; } } else { // Add field to fields_no_events array $fields_no_events[] = $fields_classic[] = $this_field; } } // Perform unique on $events and $fields arrays $fields_no_events = array_unique($fields_no_events); $fields_classic = array_unique($fields_classic); // If a longitudinal project and some fields in logic are to be evaluated on ALL events, then include all events $hasLongitudinalAllEventLogic = false; if ($Proj->longitudinal && !empty($fields_classic)) { $events = $Proj->getUniqueEventNames(); // Add flag to denote that some fields need to be checked for ALL events $hasLongitudinalAllEventLogic = true; } // Get all data for these records, fields, events $eventsGetData = empty($events) ? array_keys($Proj->eventInfo) : array_keys($events); // Longitudinal Reports- use the ordinary Records::getData as this version // is modified for row=record results, not row=record-events! //$record_data = self::getData($Proj->project_id, 'array', $records, array_merge(array($Proj->table_pk), $fields_no_events), $eventsGetData); $record_data = Records::getData($Proj->project_id, 'array', $records, array_merge(array($Proj->table_pk), $fields_no_events), $eventsGetData); // Due to issues where a record contains only BLANK values for the fields $fields_no_events, the record will be removed. // In this case, re-add that record manually as empty to allow logic parsing to work as intended. $blank_records = array_diff($records, array_keys($record_data)); if (!empty($blank_records)) { foreach ($blank_records as $this_record) { foreach ($eventsGetData as $this_event_id) { foreach ($fields_no_events as $this_field) { $record_data[$this_record][$this_event_id][$this_field] = ''; } } } } // LongitudinalReports - need to add missing events too... foreach ($record_data as $this_record_id => $this_record) { $blank_events = array_diff(array_keys($events), array_keys($this_record)); if (!empty($blank_events)) { foreach ($blank_events as $this_event_id) { foreach ($fields_no_events as $this_field) { $record_data[$this_record_id][$this_event_id][$this_field] = ''; } } } } // Place all logic functions in array so we can call them quickly $logicFunctions = array(); // Loop through all relevent events and build event-specific logic and anonymous logic function $event_ids = array_flip($events); /* if ($Proj->longitudinal) { // Longitudinal foreach ($events as $this_event_id=>$this_unique_event) { // Customize logic for this event (longitudinal only) if ($hasLongitudinalAllEventLogic) { $this_logic = LogicTester::logicPrependEventName($logic, $events[$this_event_id]); } else { $this_logic = $logic; } // Generate logic function and argument map try { list ($funcName, $argMap) = $parser->parse($this_logic, $event_ids); } catch(ErrorException $e) { return false; } // Add to array $logicFunctions[$this_event_id] = array('funcName'=>$funcName, 'argMap'=>$argMap); //, 'code'=>$parser->generatedCode); } } else { // Classic */ // Longitudinal Reports - row per participant so evaluate across events // Generate logic function and argument map try { list($funcName, $argMap) = $parser->parse($logic, $event_ids); } catch (ErrorException $e) { return false; } // Add to array // incl generated code for info $logicFunctions[$Proj->firstEventId] = array('funcName'=>$funcName, 'argMap'=>$argMap); //, 'code'=>$parser->generatedCode); $logicFunctions[$Proj->firstEventId] = array('funcName' => $funcName, 'argMap' => $argMap, 'code' => $parser->generatedCode); // } // Loop through each record-event and apply logic $records_logic_true = array(); foreach ($record_data as $this_record => &$event_data) { /* No NOT loop through events, just records! * // Loop through events in this record foreach (array_keys($event_data) as $this_event_id) { // Execute the logic to return boolean (return TRUE if is 1 and not 0 or FALSE) $logicValid = (LogicTester::applyLogic($logicFunctions[$this_event_id]['funcName'], $logicFunctions[$this_event_id]['argMap'], $event_data, $Proj->firstEventId) === 1); // Add record-event to array if logic is valid if ($logicValid) $record_events_logic_true[$this_record][$this_event_id] = true; } // Remove each record as we go to conserve memory unset($record_data[$this_record]); */ $this_event_id = $Proj->firstEventId; // Execute the logic to return boolean (return TRUE if is 1 and not 0 or FALSE) $logicValid = LogicTester::applyLogic($logicFunctions[$this_event_id]['funcName'], $logicFunctions[$this_event_id]['argMap'], $event_data, $Proj->firstEventId) === 1; // Add record to array if logic is valid if ($logicValid) { $records_logic_true[$this_record] = true; } // Remove each record as we go to conserve memory unset($record_data[$this_record]); } // Return array of records-events where logic is true return $records_logic_true; }
public function recordsAction() { $recordsModel = new Records(); $records = $recordsModel->getAll($sort, $sorttype); $page = $this->_getParam('page', 1); $paginator = Zend_Paginator::factory($records); $paginator->setItemCountPerPage(100); $paginator->setCurrentPageNumber($page); $this->view->records = $paginator; }
<?php $model = Accounts::model(); /* @var $this AccountsController */ /* @var $data Accounts */ /* @var $model Accounts*/ /* @var $recordMdl Records*/ $recordMdl = Records::model(); $recordMdl->account_id = $data->account_id; $newBaseUrl = Yii::app()->baseUrl; /*Add style*/ $newStyle = <<<EOL .site-availability-indicator{ height: 36px; background-color: green; float: right; width: 36px; border-radius: 81px; position: relative; top: -16px; margin-bottom: -31px; padding: 6px; text-align: center; vertical-align: middle; height: 35px; width: 45px; padding: 6px; text-align: center; vertical-align: middle; height: 35px; padding-top: 15px;
/** * Returns a json report on an acccount using hostname */ public function actionGetClaimReport() { //get a record model using hostname header('Content-Type: application/json'); $jsonMessage = array(); if ($_POST['hostname']) { $hostname = parse_url($_POST['hostname'], PHP_URL_HOST); $criteria = new CDbCriteria(); $criteria->join = 'right join claimaccount ON claimaccount.account_id = t.account_id'; $criteria->compare("claimaccount.websiteURL", $hostname); $record = Records::model()->find($criteria); if ($record) { $jsonMessage['success'] = true; $jsonMessage['totalNumEntries'] = $record->getTotalNumberOfEntries(); $jsonMessage['totalEntriesToday'] = $record->getTotalNumberOfEntriesToday(); $jsonMessage['totalTheseWeek'] = $record->getThisWeekreport(); $jsonMessage['message'] = $hostname; } } else { $jsonMessage['success'] = false; } echo json_encode($jsonMessage); // }
public function actionMobile() { if (isset($_REQUEST['accountID'])) { $accountMdl = Accounts::model()->findByPk($_REQUEST['accountID']); $fileName = $accountMdl->claimAccountName . ' - ' . date("Y-m-d") . '-all-mobilenumbers'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"{$fileName}.csv\";"); header("Content-Transfer-Encoding: binary"); $criteria = new CDbCriteria(); $criteria->compare("account_id", $_REQUEST['accountID']); $criteria->order = "date_created DESC"; $records = Records::model()->findAll($criteria); $isFirst = true; foreach ($records as $curRecord) { $data = json_decode($curRecord->claimData, true); if ($isFirst) { //print heads echo "Mobile Number\n"; $isFirst = false; } //retrieve mobile number $arrayVals = array_values($data); $extractedMobile = MobileNumberExtractor::extractMobileNumbers($arrayVals); if ($extractedMobile != false) { /* check if present at blacklist*/ $crt = new CDbCriteria(); $crt->compare('mobile_number', $extractedMobile); if (!BlackListedMobile::model()->exists($crt)) { echo $extractedMobile . PHP_EOL; } } } } else { throw new CHttpException(404, "Yikes , You forgot to pass in the Account ID"); } }
function insert() { $this->records = array(array('id' => 1, 'username' => 'admin', 'password' => Security::hash('password', null, true), 'active' => 1, 'flagged' => 0, 'group_id' => 1, 'reset_password' => 1)); parent::insert(); }
public function __construct($app_id, $app_secret, $token, $environment, $agency) { parent::__construct($app_id, $app_secret, $token, $environment, $agency); } public function searchRecords($path, $params, $body) { return parent::sendPost($path, AuthType::$NoAuth, $params, $body); } public function __destruct() { parent::__destruct(); } } try { // Create new instance of custom object. $records = new Records($app_id, $app_secret, $access_token, $environment, $agency); // Set path to look up records. $path = '/v4/search/records/'; // Params $params = array("limit" => 3, "expand" => "addresses"); // Search criteria. $body = array("contacts" => array("lastName" => "Smith")); // Get the response from the Construct API. Print out ID for each record & status. $response = $records->searchRecords($path, $params, $body); foreach ($response->result as $record) { echo $record->id . "\n"; } } catch (ConstructException $ex) { $details = json_decode($ex->getMessage()); echo "Code: " . $ex->getCode() . "\n"; echo "Message: " . $details->message . "\n";
public function deleterecordsAction() { if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); unset($data['method']); $search = array(); if (trim($data['startdate']) != '') { $startdate = date('Y-m-d', strtotime($data['startdate'])); $search['startdate'] = $startdate; } if (trim($data['enddate']) != '') { $enddate = date('Y-m-d', strtotime($data['enddate'])); $search['enddate'] = $enddate; } if (trim($data['reason']) != '') { $search['reason'] = $reason; } unset($data['startdate']); unset($data['enddate']); foreach ($data as $key => $value) { if (trim($value) != '') { $search[$key] = $value; } } $recordsModel = new Records(); if ($this->_me->admin == 1) { $recordsSelect = $recordsModel->getAll(null, null, $search); } else { $recordsSelect = $recordsModel->getAllByLocation($this->_me->location, null, $search); } $records = $recordsModel->fetchAll($recordsSelect); $ids = []; if (count($records) > 0) { foreach ($records as $recode) { $ids[] = $recode['id']; } } if (count($ids) > 0) { $recordsModel->deleteMultiple(implode(",", $ids)); } $searchString = urlencode(base64_encode(serialize($search))); $this->_redirect("/editrecords/1/date/desc/" . $searchString); die; } }
if ((isset($_GET['id']) && PAGE == "DataEntry/grid.php") || (isset($fetched) && PAGE == "DataEntry/index.php") || !$longitudinal) { // Show record name on left-hand menu (if a record is pulled up) $record_label = ""; if ((isset($_GET['id']) && PAGE == "DataEntry/grid.php") || (isset($fetched) && PAGE == "DataEntry/index.php" && isset($_GET['event_id']) && is_numeric($_GET['event_id']))) { require_once APP_PATH_DOCROOT . 'ProjectGeneral/form_renderer_functions.php'; if (PAGE == "DataEntry/grid.php") { $fetched = $_GET['id']; } $record_display = RCView::b(RCView::escape($_GET['id'])); // Get Custom Record Label and Secondary Unique Field values (if applicable) $this_custom_record_label_secondary_pk = Records::getCustomRecordLabelsSecondaryFieldAllRecords(addDDEending($fetched), false, getArm(), true); if ($this_custom_record_label_secondary_pk != '') { $record_display .= " $this_custom_record_label_secondary_pk"; } // DISPLAY RECORD NAME: Set full string for record name with prepended label (e.g., Study ID 202) if ($longitudinal) { // Longitudinal project: Display record name as link and "select other record" link $record_label = RCView::div(array('style'=>'padding:0 0 4px;color:#800000;font-size:12px;'), RCView::div(array('style'=>'float:left;'), RCView::a(array('style'=>'color:#800000;','href'=>APP_PATH_WEBROOT."DataEntry/grid.php?pid=$project_id&id=$fetched&arm=".getArm()), RCView::img(array('src'=>'application_view_tile.png','class'=>'imgfix')) . strip_tags(label_decode($table_pk_label)) . " " . $record_display ) ) . RCView::div(array('style'=>'float:right;line-height:18px;'), RCView::a(array('id'=>'menuLnkChooseOtherRec','class'=>'opacity50','style'=>'color:#000066;vertical-align:middle;text-decoration:underline;font-size:10px;','href'=>APP_PATH_WEBROOT."DataEntry/grid.php?pid=$project_id"),
//$empty_result = db_query("SELECT * FROM redcap_data WHERE project_id = '$project_id' AND value = '' ORDER BY abs(record) ASC"); /** * exclude dm_subjid from query, as RED-I writes orphan records to this field, and we don't want to screw that up, do we? */ $empty_result = db_query("SELECT * FROM redcap_data WHERE project_id = '$project_id' AND field_name = '{$_POST['field_name']}' ORDER BY abs(record) ASC"); if ($empty_result) { while ($empty_row = db_fetch_assoc($empty_result)) { $history = Form::getDataHistoryLog($empty_row['record'], $empty_row['event_id'], $empty_row['field_name']); $all_fields_hidden = $my_branching_logic->allFieldsHidden($empty_row['record'], $empty_row['event_id'], array($empty_row['field_name'])); if ($debug) { /** * pick apart the hidden field logic - something's not right with fib_lbtest logic. ?'null'? */ $fieldsDependent = getDependentFields(array($empty_row['field_name']), false, true); $unique_event_name = $project->getUniqueEventNames($empty_row['event_id']); $record_data = Records::getSingleRecordData($empty_row['record'], array_merge($fieldsDependent, array($empty_row['field_name']))); $logic = $project->metadata[$empty_row['field_name']]['branching_logic']; if ($longitudinal) { $logic = LogicTester::logicPrependEventName($logic, $unique_event_name); } if (LogicTester::isValid($logic)) { $displayField = LogicTester::apply($logic, $record_data); $displayField = $displayField ? false : true; } show_var($fieldsDependent, 'DEP FIELDS'); show_var($unique_event_name, 'unique event name'); show_var($record_data, 'record data'); show_var($logic, 'logic'); show_var($displayField, 'all hidden?'); } /**
echo User::number_format_user($num_records_group); ?> </b> <?php } ?> </td> </tr> <?php /*************************************************************** ** DROP-DOWNS ***************************************************************/ if ($num_records <= $maxNumRecordsHideDropdowns) { print "<tr>\n\t\t\t\t\t<td class='labelrc'>{$lang['grid_31']} " . RCView::escape($table_pk_label) . "</td>\n\t\t\t\t\t<td class='data'>"; // Obtain custom record label & secondary unique field labels for ALL records. $extra_record_labels = Records::getCustomRecordLabelsSecondaryFieldAllRecords(array(), true, $arm); if ($extra_record_labels) { foreach ($extra_record_labels as $this_record => $this_label) { $dropdownid_disptext[removeDDEending($this_record)] .= " {$this_label}"; } } unset($extra_record_labels); /** * ARM SELECTION DROP-DOWN (if more than one arm exists) */ //Loop through each ARM and display as a drop-down choice if ($multiple_arms && $arm_dropdown_choices != "") { print "<select id='arm_name' class='x-form-text x-form-field' style='margin-right:20px;' onchange=\"\n\t\t\t\t\t\tif (\$('#record').val().length > 0) {\n\t\t\t\t\t\t\twindow.location.href = app_path_webroot+'DataEntry/grid.php?pid={$project_id}&id='+\$('#record').val()+'&arm='+\$('#arm_name').val()+addGoogTrans();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tshowProgress(1);\n\t\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t\twindow.location.href = app_path_webroot+'DataEntry/grid.php?pid={$project_id}&arm='+\$('#arm_name').val()+addGoogTrans();\n\t\t\t\t\t\t\t},500);\n\t\t\t\t\t\t}\n\t\t\t\t\t\">\n\t\t\t\t\t{$arm_dropdown_choices}\n\t\t\t\t\t</select>"; } /** * RECORD SELECTION DROP-DOWN
echo "\t\t<th class=\"box_header\" width=\"5%\"><div align=\"center\">Centre</div></th>"; echo "\t\t<th class=\"box_header\" width=\"12%\"><div align=\"left\">Course Code</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"40%\"><div align=\"left\">Course Title</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"8%\"><div align=\"center\">Target Places</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"8%\"><div align=\"center\">Total Places</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"8%%\"><div align=\"center\">Students Enrolled</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"8%\"><div align=\"center\">Target Shortfall</div></th>"; echo "\t\t<th class=\"box_header\" width=\"8%\"><div align=\"center\">Maximum Shortfall</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"9%\"><div align=\"center\">Enrolled 16-18</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"9%\"><div align=\"center\">Enrolled 19+</div> </th>"; echo "\t\t<th class=\"box_header\" width=\"9%\" style=\"border-right: 1px solid #000000;\"><div align=\"center\">Enrolled Overseas</div></th>"; echo "\t</tr>"; echo "</thead>"; echo "<tbody>"; $xml = file_get_contents("http://ptextend.ccb.ac.uk:83/gmpdev/EnrolmentDisplay/CourseEnrolmentsXML?pam={$pam}&year={$year}&course_type={$course_type}&attendance_type={$attendance_type}&additionality_type={$additionality_type}&funding_type={$funding_type}"); $my_records_courses = new Records($xml); $row_index = 0; $rows_per_page = 5; $display_this_row = 0; $page = 0; $totals = array('TARGET_PLACES' => 0, 'TOTAL_PLACES' => 0, 'STUDENTS_ENROLLED' => 0, 'TARGET_SHORTFALL' => 0, 'MAXIMUM_SHORTFALL' => 0, 'ENROLLED_16_TO_18' => 0, 'ENROLED_OVER_19' => 0, 'ENROLLED_OVERSEAS' => 0); foreach ($my_records_courses->rows as $row) { if ($page != '') { if ($row_index >= $page * $rows_per_page) { $display_this_row = true; } else { $display_this_row = false; } } else { $display_this_row = true; }
{ $sex = $this->checkSex(substr($number, 0, 1)); $date_of_birth = $this->checkBirthDate(substr($number, 5, 2), substr($number, 3, 2), substr($number, 1, 2)); $text = "Person is: {$sex} in {$date_of_birth} \n"; echo $text; } function checkSex($number) { if ($number < 5) { if ($number % 2) { return 'Male born in Hungary'; } else { return 'Female born in Hungary'; } } else { if ($number % 2) { return 'Male born outside of Hungary'; } else { return 'Female born outside of Hungary'; } } } function checkBirthDate($day, $month, $year) { return "{$day}-{$month}-{$year}"; } } $query = "SELECT * FROM `numbers`"; $all_data = $mysqli->query($query); $record = new Records(); $record->checkCountry($all_data);
//Check if it's a valid date if (!checkdate($_GET['month'], $_GET['day'], $_GET['year'])) { exit("<b>{$lang['global_01']}{$lang['colon']}</b><br>{$lang['calendar_popup_19']}"); } print "<div style='color:green;font-family:verdana;padding:5px;margin-bottom:10px;font-weight:bold;font-size:16px;border-bottom:1px solid #aaa;'>\n\t\t\t\t{$lang['calendar_popup_20']}</div>\n\t\t\t\n\t\t\t<form method='post' action='{$_SERVER['PHP_SELF']}?pid={$project_id}&width=600' name='form'>\n\t\t\t<table style='font-family:Arial;font-size:14px;' cellpadding='0' cellspacing='10'>"; // Show option to attach calendar event to a record (i.e. unscheduled cal event) if ($_GET['record'] != "") { $_GET['record'] = strip_tags(label_decode($_GET['record'])); print "\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>{$table_pk_label}: </td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<b>" . RCView::escape(removeDDEending($_GET['record'])) . "</b>\n\t\t\t\t\t<input type='hidden' name='idnumber' value='" . RCView::escape($_GET['record']) . "'>\n\t\t\t\t</td>\n\t\t\t</tr>"; } print "<tr>\n\t\t\t\t<td valign='top'>{$lang['global_18']}{$lang['colon']}</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<b>" . DateTimeRC::format_ts_from_ymd($event_date) . " (" . DateTimeRC::getDay($event_date) . ")</b>\n\t\t\t\t\t<input type='hidden' id='event_date' name='event_date' value='{$event_date}'>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t{$lang['global_13']}{$lang['colon']}\n\t\t\t\t\t<div style='font-size:10px;color:#888;'>{$lang['global_06']}</div>\n\t\t\t\t</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<input type='text' class='x-form-text x-form-field time' id='event_time' name='event_time' maxlength='5' style='width:50px;' onblur=\"redcap_validate(this,'','','soft_typed','time')\"> \n\t\t\t\t\t<span style='font-size:10px;color:#777;font-family:tahoma;'>HH:MM ({$lang['calendar_popup_22']})</span>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>{$lang['calendar_popup_11']}{$lang['colon']}</td>\n\t\t\t\t<td valign='top'><textarea id='notes' name='notes' class='x-form-textarea x-form-field' style='font-size:12px;width:400px;height:100px;'>{$row['notes']}</textarea></td>\n\t\t\t</tr>"; // Show option to attach calendar event to a record (i.e. unscheduled cal event) if ($_GET['record'] == "") { print "<tr>\n\t\t\t\t\t<td valign='top'>{$table_pk_label}: </td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<table cellpadding=0 cellspacing=0><tr>\n\t\t\t\t\t\t<td valign='top'>\n\t\t\t\t\t\t\t<select name='idnumber' id='idnumber' class='x-form-text x-form-field' style='height:22px;padding-right:0;font-size:11px;'>\n\t\t\t\t\t\t\t<option value=''> - {$lang['calendar_popup_23']} - </option>"; // Retrieve record list (exclude non-DAG records if user is in a DAG) foreach (array_keys(Records::getData('array', array(), $table_pk, array(), $user_rights['group_id'])) as $this_record) { print "\t\t\t<option value='{$this_record}'>" . removeDDEending($this_record) . "</option>"; } print "\t\t\t</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:11px;color:#666;padding-left:10px;'>\n\t\t\t\t\t\t\t{$lang['calendar_popup_24']} {$table_pk_label}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr></table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } print "<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<br><br>\n\t\t\t\t\t<input type='submit' value='{$lang['calendar_popup_25']}' onclick=\"\n\t\t\t\t\t\tif (document.getElementById('notes').value.length < 1) {\n\t\t\t\t\t\t\talert('{$lang['calendar_popup_26']}');\n\t\t\t\t\t\t\treturn false;\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\">\n\t\t\t\t\t<br><br>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</form>"; /** * DISPLAY CONFIRMATION THAT NEW CALENDAR EVENT WAS CREATED */ } elseif (!isset($_GET['cal_id']) && !empty($_POST)) { //If an existing record was selected, make sure record doesn't already exist in a DAG. If so, add its group_id to calendar event. if ($_POST['idnumber'] != "") { $group_id = db_result(db_query("select value from redcap_data where project_id = {$project_id} and record = '{$_POST['idnumber']}' and field_name = '__GROUPID__' limit 1"), 0); //If did not select a record, check if user is in DAG. } elseif ($user_rights['group_id'] != "") { $group_id = $user_rights['group_id'];
public function getThisWeekreport() { //using accountID $criteria = new CDbCriteria(); $criteria->compare("account_id", $this->account_id); /* sunday 00.00 hrs - saturday 23:59 hrs*/ // $startingDate = date("Y-m-d 24:00:00",strtotime('sunday last week') ); // $endDate = date("Y-m-d 23:59:59",strtotime('saturday this week') ); $startingDate = date("Y-m-d 12:00:00", strtotime('friday last week')); $endDate = date("Y-m-d 23:59:00", strtotime('friday this week')); $criteria->addBetweenCondition("date_created", $startingDate, $endDate); //$criteria->group = "ip_address"; $criteria->distinct = true; return Records::model()->count($criteria); }