public function get_under_supervisor($centre_id, $supervisor_id) { $user_ids = $this->db->distinct()->select('user_id')->from(IMS_DB_PREFIX . 'user_role')->where('role_id', '7')->or_where('role_id', '1')->or_where('role_id', '2')->where('centre_id', $centre_id)->get()->result(); $user_ids = pluck($user_ids, 'user_id'); $result['users'] = $this->db->select('u.id, u.first_name, u.last_name')->from(IMS_DB_PREFIX . 'user as u')->where('u.centre_id', $centre_id)->where('u.active', 1)->where_not_in('u.id', $user_ids)->get()->result(); if (in_array($supervisor_id, $user_ids)) { $result['supervisor_user'] = $this->db->select('u.id, u.first_name, u.last_name')->from(IMS_DB_PREFIX . 'supervisor_user as su')->join(IMS_DB_PREFIX . 'user as u', 'u.id=su.user_id')->where('su.supervisor_id', $supervisor_id)->where('su.centre_id', $centre_id)->get()->result(); } else { $result['supervisor_user'] = array(); } return $result; }
function getFilteredTask($perpage = NULL, $offset = NULL, $level_ids = NULL, $subject_ids = NULL, $search_key = NULL, $sort = NULL) { $where = array(); if ($level_ids) { if (is_array($level_ids)) { $this->db->where_in('level_id', pluck($level_ids, 'id')); } else { $this->db->where('level_id', $level_ids); } } if ($subject_ids) { if (is_array($subject_ids)) { $this->db->where_in('subject_id', pluck($subject_ids, 'id')); } else { $this->db->where('subject_id', $subject_ids); } } if ($search_key) { // $this->db->like('concat(task,task_caption)', $search_key); $this->db->where('(concat(task,task_caption) like "%' . $search_key . '%" OR id = "' . $search_key . '")'); } if (!is_null($sort)) { // $this->db->order_by("trim(LEADING ' ' FROM t." . $sort['name'] . ")", $sort['type']); // $this->db->order_by("TRIM(" . $sort['name'] . ")", $sort['type']); if ($sort['name'] == 'id') { $this->db->order_by("t." . $sort['name'], $sort['type']); } else { $this->db->order_by("TRIM(TRIM(LEADING '\n' FROM t." . $sort['name'] . "))", $sort['type']); } } if (!is_null($perpage) and !is_null($offset)) { $this->db->limit($perpage, $offset); } $result = $this->db->select("*")->from(IMS_DB_PREFIX . 'task as t')->get()->result(); return $result; }
function getStudentInvoiceList() { $student_id = $this->input->post('student_id'); $invoice_list = $this->payment_model->select('receipt_number')->getWhere(array('student_id' => $student_id), IMS_DB_PREFIX . 'invoice'); $invoice_list = pluck($invoice_list, 'receipt_number'); die(json_encode($invoice_list)); }
public function GetChildProgressReport() { $params = $this->_check_parameter(array('progressReportID', 'assessmentCategoryID')); $this->load->model('progress_report/progress_report_model'); $this->load->model('parent_account/parent_account_model'); $this->load->model('sow/sow_model'); $progress_report_details = $this->progress_report_model->getFromId($params->progressReportID); $progress_assessments = $this->progress_report_model->getProgressAssessments($params->progressReportID, $params->assessmentCategoryID); // debug($this->db->last_query()); // debug_continue(count($progress_assessments)); // debug($progress_assessments); $assessments = array(); foreach ($progress_assessments as $progress_assessment) { $assessments[$progress_assessment->assessment_id] = $progress_assessment; $assessments[$progress_assessment->assessment_id]->rubrics = array(); $assessments[$progress_assessment->assessment_id]->all_scores = array(); } // debug_continue(count($assessments)); // debug($assessments); $assessment_ids = array_unique(pluck($progress_assessments, 'assessment_id')); $sow_ids = pluck($progress_assessments, 'sow_id'); // debug($sow_ids, 'sow_ids'); if (count($assessment_ids) > 0) { $rubrics = $this->parent_account_model->getRubricByAssessment($assessment_ids); foreach ($rubrics as $rubric) { if (isset($assessments[$rubric->assessment_id]->rubrics)) { $assessments[$rubric->assessment_id]->rubrics[] = $rubric; } } $all_progress_assessments = $this->parent_account_model->getAllProgressAssessments($assessment_ids); foreach ($all_progress_assessments as $all_progress_assessment) { if (isset($assessments[$all_progress_assessment->assessment_id]->all_scores)) { $assessments[$all_progress_assessment->assessment_id]->all_scores[] = $all_progress_assessment->rubric_passed; } } foreach ($assessments as &$assessment) { $assessment->stat = progress_stat($assessment->all_scores, count($assessment->rubrics)); unset($assessment->all_scores); } } $this->_response['assessments'] = array(); foreach ($assessments as $assessment) { $this->_response['assessments'][] = $assessment; } if (!empty($sow_ids)) { $sow_album = $this->sow_model->getAllSowAlbum($sow_ids, $progress_report_details->student_id); // debug($sow_album, 'sow_album'); // debug($this->_response['sow_album_items']); $this->_response['sow_album_items'] = array(); $i = 0; if (!empty($sow_album)) { foreach ($sow_album as $row) { if (isset($this->_response['sow_album_items'][$row->assessment_category_id])) { if (count($this->_response['sow_album_items'][$row->assessment_category_id]) < 6 and !isset($this->_response['sow_album_items'][$row->assessment_category_id][$row->id])) { $this->_response['sow_album_items'][$row->assessment_category_id][$row->id] = $row; } } else { $this->_response['sow_album_items'][$row->assessment_category_id][$row->id] = $row; } } } } echo json_encode($this->_response); }
public function rows($col = null) { if (!isset($this->result)) { $this->query(); } $return = array(); if ($this->count() == 0) { return $return; } while ($data = mysql_fetch_assoc($this->result)) { $return[] = $data; } if ($col) { return pluck($return, $col); } return $return; }
</div> <div class="five columns omega inputs"> <?php echo $this->formTextarea('description', $exhibit->description, array('rows' => '8', 'cols' => '40')); ?> </div> </div> <div class="field"> <div class="two columns alpha"> <?php echo $this->formLabel('tags', __('Tags')); ?> </div> <div class="five columns omega inputs"> <?php $exhibitTagList = join(', ', pluck('name', $exhibit->Tags)); ?> <?php echo $this->formText('tags', $exhibitTagList); ?> </div> </div> <div class="field"> <div class="two columns alpha"> <?php echo $this->formLabel('theme', __('Theme')); ?> </div> <div class="five columns omega inputs"> <?php $values = array('' => __('Current Public Theme')) + exhibit_builder_get_themes();
function getCenterSubjectIds($centre_id) { $subject_ids = $this->db->select('s.id')->from('subject as s')->join('centre_subject as cs', 'cs.subject_id = s.id')->where('cs.centre_id', $centre_id)->where('s.is_archive', 0)->get()->result(); return pluck($subject_ids, 'id'); }
function attendance_list_by_student() { if ($this->input->is_ajax_request()) { $this->load->model('kin/kin_model'); if ($this->input->get('search_by') == 'nric') { $attendance_list = $this->attendance_model->getAttendanceListByStudent($this->input->get('search_key'), NULL, mysqlDateFormat($this->input->get('from_date')), mysqlDateFormat($this->input->get('to_date'))); } elseif ($this->input->get('search_by') == 'name') { $attendance_list = $this->attendance_model->getAttendanceListByStudent(NULL, $this->input->get('search_key'), mysqlDateFormat($this->input->get('from_date')), mysqlDateFormat($this->input->get('to_date'))); } else { $attendance_list = array(); } $this->data['attendance_list'] = $attendance_list; $chldIds = pluck($attendance_list, 'child_id'); $chldIds = is_array($chldIds) ? implode(',', $chldIds) : ''; $dropOff = $this->kin_model->get_drop_off_kin_child($chldIds); $this->data['dropOff'] = $dropOff; $this->load->view('attendance_list_by_student', $this->data); } else { $this->ims_template->build('parent_account/blank', $this->data); } }
@endif </h2> <div class="small-8 columns"> <canvas id="chart" style="width: 100%" height="250"></canvas> <div class="statistics"> <?php function pluck($key, $data) { return array_reduce($data, function ($result, $array) use($key) { isset($array[$key]) && ($result[] = $array[$key]); return $result; }, array()); } $x_values = pluck("x", $pureData); if ($hasY) { $y_values = pluck("y", $pureData); } ?> @if($hasX) The sample size is {{sizeof($x_values)}}.<br><br> The average (mean) {{$x}} is {{mmmr($x_values, 'mean')}}.<br> The median {{$x}} is {{mmmr($x_values, 'median')}}.<br> The mode {{$x}} is {{mmmr($x_values, 'mode')}}.<br> The range of {{$x}} is {{mmmr($x_values, 'range')}}. @if($hasY) <br><br> The average (mean) {{$y}} is {{mmmr($y_values, 'mean')}}.<br> The median {{$y}} is {{mmmr($y_values, 'median')}}.<br> The mode {{$y}} is {{mmmr($y_values, 'mode')}}.<br> The range of {{$y}} is {{mmmr($y_values, 'range')}}.<br><br> The correlation coefficient r is {{$corr = Correlation($x_values, $y_values)}}.<br>
function progress_report() { if ($this->module_in_array('progress_report') == FALSE) { redirect(site_url('home')); } else { $progress_report_ready = $this->options_model->getOneWhere(array('child_id' => $this->selected_child_id, 'year_term_id' => $this->selected_year_term_id), IMS_DB_PREFIX . 'child_class'); if (isset($progress_report_ready->publish) and $progress_report_ready->publish == 1) { $this->load->model(array('child/child_model', 'sow/sow_model', 'assessment/assessment_model', 'relations/teacher_class_model', 'progress_report/progress_report_model')); /* * find the level ID for the class */ $level = $this->parent_account_model->getLevelFromProgressReport($progress_report_ready); /* * get the cohort size based on the number of "Published" progress report for the level across all centres */ $this->data['cohort_size'] = $this->parent_account_model->getCohortSize($level->id); $this->data['sow_po'] = $progress_report_ready->status == 3; if ($this->data['sow_po']) { $this->data['teacher_name'] = $this->options_model->select('first_name, last_name')->getOneWhere(array('id' => $progress_report_ready->teacher_id), IMS_DB_PREFIX . 'user'); $this->data['teacher_comment'] = $progress_report_ready->teacher_comment; $this->data['teacher_image'] = $this->options_model->select('avatar, avatar_hash')->getOneWhere(array('id' => $progress_report_ready->teacher_id), IMS_DB_PREFIX . 'user'); $height_weight_data = $this->progress_report_model->order_by('year_term_id')->getWhere(array('child_id' => $this->selected_child_id, 'year_term_id <=' => $this->selected_year_term_id), IMS_DB_PREFIX . 'child_class'); $height_chart_data = array(array('Year-Term', 'Height')); $weight_chart_data = array(array('Year-Term', 'Weight')); foreach ($height_weight_data as $data) { if ($this->selected_year_term_id == $data->year_term_id) { $this->data['child_image'] = $data->image; } if ($data->height > 0) { $height_chart_data[] = array(substr_replace($data->year_term_id, '-', 4, 0), (int) $data->height); } if ($data->weight > 0) { $weight_chart_data[] = array(substr_replace($data->year_term_id, '-', 4, 0), (int) $data->weight); } } $this->data['height_chart_data'] = $height_chart_data; $this->data['weight_chart_data'] = $weight_chart_data; } $report = array(); $progress_reports = $this->progress_report_model->getApprovedProgressReports($this->selected_child_id, $this->selected_year_term_id); // debug($this->db->last_query()); // debug(count($progress_reports)); $progress_report_ids = pluck($progress_reports, 'id'); if (count($progress_report_ids) > 0) { foreach ($progress_reports as $progress_report) { $report[$progress_report->id] = $progress_report; $report[$progress_report->id]->progress_assessment_categories = array(); } $progress_assessments = $this->progress_report_model->getProgressAssessments($progress_report_ids); $assessments = array(); foreach ($progress_assessments as $progress_assessment) { if (isset($report[$progress_assessment->progress_report_id]->progress_assessment_categories)) { $report[$progress_assessment->progress_report_id]->progress_assessment_categories[$progress_assessment->assessment_category_id] = array('assessment_category_name' => $progress_assessment->assessment_category_name, 'assessments' => array()); } $assessments[$progress_assessment->assessment_id] = $progress_assessment; $assessments[$progress_assessment->assessment_id]->rubrics = array(); $assessments[$progress_assessment->assessment_id]->all_scores = array(); } $assessment_ids = pluck($progress_assessments, 'assessment_id'); $sow_ids = pluck($progress_assessments, 'sow_id'); if (count($assessment_ids) > 0) { $rubrics = $this->parent_account_model->getRubricByAssessment($assessment_ids); foreach ($rubrics as $rubric) { if (isset($assessments[$rubric->assessment_id]->rubrics)) { $assessments[$rubric->assessment_id]->rubrics[] = $rubric; } } $all_progress_assessments = $this->parent_account_model->getAllProgressAssessments($assessment_ids); foreach ($all_progress_assessments as $all_progress_assessment) { if (isset($assessments[$all_progress_assessment->assessment_id]->all_scores)) { $assessments[$all_progress_assessment->assessment_id]->all_scores[] = $all_progress_assessment->rubric_passed; } } } foreach ($assessments as $assessment) { if (isset($report[$assessment->progress_report_id]->progress_assessment_categories[$assessment->assessment_category_id]['assessments'])) { $report[$assessment->progress_report_id]->progress_assessment_categories[$assessment->assessment_category_id]['assessments'][] = $assessment; } } $this->data['total'] = count($assessments); if (!empty($sow_ids)) { $sow_album = $this->sow_model->getAllSowAlbum($sow_ids, $this->selected_child_id); $this->data['sow_album'] = array(); if (!empty($sow_album)) { foreach ($sow_album as $row) { if (isset($this->data['sow_album'][$row->assessment_category_id])) { if (count($this->data['sow_album'][$row->assessment_category_id]) < 6 and !isset($this->data['sow_album'][$row->assessment_category_id][$row->id])) { $this->data['sow_album'][$row->assessment_category_id][$row->id] = $row; } } else { $this->data['sow_album'][$row->assessment_category_id][$row->id] = $row; } } } } } $this->data['report'] = $report; // debug($this->data['report']); if ($this->input->is_ajax_request()) { $this->load->view('view_progress_report', $this->data); } else { $this->ims_template->build('parent_account/blank', $this->data); } } else { if ($this->input->is_ajax_request()) { $this->load->view('view_progress_report_unready', $this->data); } else { $this->ims_template->build('parent_account/blank', $this->data); } } } }
/** * Get all known log types (distinct table). * * @return array Log types */ public function get_log_types() { $this->load->helper('array'); $this->db->select('DISTINCT(action)'); $this->db->order_by('action'); $results = $this->db->get('log')->result_array(); return pluck($results, 'action'); }
protected function render() { $prop = $this->props; $isMultiple = $prop->multiple; $assets = $this->context->getAssetsService(); $assets->addInlineScript("selenia.ext.select.props['{$prop->id}']=" . JavascriptCodeGen::makeOptions(['autoOpenLinked' => $prop->autoOpenLinked, 'dataUrl' => $prop->dataUrl, 'emptyLabel' => $prop->emptyLabel, 'emptySelection' => $prop->emptySelection, 'id' => $prop->id, 'labelField' => $prop->labelField, 'linkedSelector' => $prop->linkedSelector, 'linkedUrl' => $prop->linkedUrl, 'multiple' => $prop->multiple, 'noResultsText' => $prop->noResultsText, 'valueField' => $prop->valueField, 'value' => $prop->value])); // If required, add auto-add tag behavior to this Chosen. if ($prop->autoTag && $prop->multiple) { $assets->addInlineScript("\n\$(function () {\n \$ ('#{$prop->id}+.chosen-container .chosen-choices input').on ('keyup', function (ev) { console.log(ev);\n var v = \$ (this).val ();\n if (ev.keyCode == 13 && v) {\n var tags = \$ ('#{$prop->id} option').map (function (i, e) { return \$ (e).val () });\n var found = false, l = v.length;\n tags.each (function (i, x) {\n if (x.substr (0, l) == v) {\n found = true;\n return false\n }\n });\n if (found) return;\n \$ ('#{$prop->id}').append (\"<option>\" + v + \"</option>\");\n \$ ('#{$prop->id}').trigger ('chosen:updated');\n ev.preventDefault ();\n var e = jQuery.Event (\"keyup\");\n e.which = 13;\n \$ ('#{$prop->id}+.chosen-container .chosen-choices input').val (v).trigger ('keyup').trigger (e);\n }\n })\n});\n"); } $this->attr('name', $prop->multiple ? "{$prop->name}[]" : $prop->name); $this->attrIf($isMultiple, 'multiple', ''); $this->attrIf($prop->onChange, 'onchange', $prop->onChange); $this->beginContent(); if ($prop->emptySelection && !$prop->multiple) { $sel = exists($prop->value) ? '' : ' selected'; echo '<option value=""' . $sel . '>' . $prop->emptyLabel . '</option>'; } $viewModel = $prop->get('data'); if (isset($viewModel)) { /** @var \Iterator $dataIter */ $dataIter = iteratorOf($viewModel); $dataIter->rewind(); if ($dataIter->valid()) { $values = $selValue = null; // SETUP MULTI-SELECT if ($isMultiple) { if (isset($prop->value) && !is_iterable($prop->value)) { throw new ComponentException($this, sprintf("Value of multiple selection component must be iterable or null; %s was given.", typeOf($prop->value))); } $it = Flow::from($prop->value); $it->rewind(); $values = $it->valid() && is_scalar($it->current()) ? $it->all() : $it->map(pluck($prop->valueField))->all(); } else { $selValue = strval($prop->get('value')); } // NOW RENDER IT $template = $this->getChildren('listItemTemplate'); $first = true; do { $v = $dataIter->current(); $value = getField($v, $prop->valueField); $label = getField($v, $prop->labelField); if (!strlen($label)) { $label = $prop->emptyLabel; } if ($isMultiple) { $sel = array_search($value, $values) !== false ? ' selected' : ''; } else { if ($first && !$prop->emptySelection && !$prop->multiple && !exists($selValue)) { $prop->value = $selValue = $value; } $eq = $prop->strict ? $value === $selValue : $value == $selValue; if ($eq) { $this->selectedLabel = $label; } $sel = $eq ? ' selected' : ''; } if ($template) { // Render templated list $viewModel['value'] = $value; $viewModel['label'] = $label; Component::renderSet($template); } else { // Render standard list echo "<option value=\"{$value}\"{$sel}>{$label}</option>"; } $dataIter->next(); $first = false; } while ($dataIter->valid()); } } }
private function _updateProgressAssessment($progress_report_id, $assessments, $progress_report_assessments, $progress_report = NULL) { $db_assessment_ids = pluck($progress_report_assessments, 'assessment_id'); $current_assessment_ids = pluck($assessments, 'id'); $delete = array_diff($db_assessment_ids, $current_assessment_ids); $new = array_diff($current_assessment_ids, $db_assessment_ids); $update = array_intersect($db_assessment_ids, $current_assessment_ids); if (!empty($delete)) { $this->progress_report_model->where_in('assessment_id', $delete)->deleteWhere(array('progress_report_id' => $progress_report->id), IMS_DB_PREFIX . 'progress_report_assessment'); } if (!empty($new)) { foreach ($assessments as $i => $assessment) { if (!in_array($assessment->id, $new)) { unset($assessments[$i]); } } $this->_insertProgressAssessment($progress_report_id, $assessments); } if (!empty($update)) { foreach ($progress_report_assessments as $i => $report_assessment) { if (!in_array($report_assessment->assessment_id, $update)) { unset($progress_report_assessments[$i]); } } $teacher_comment = $this->input->post('teacher_comment'); $passed_rubric = $this->input->post('passed_rubric'); $progress_report_assessment = array(); foreach ($progress_report_assessments as $i => $report_assessment) { $progress_report_assessment[$i] = array('id' => $report_assessment->id, 'rubric_passed' => $passed_rubric[$report_assessment->assessment_id], 'teacher_comment' => $teacher_comment[$report_assessment->assessment_id]); } if (!empty($progress_report_assessment)) { $this->progress_report_model->updateRows($progress_report_assessment, 'id', IMS_DB_PREFIX . 'progress_report_assessment'); } } }
/** * Check if field has an index (in development only) * @param string $field Field name */ protected function _check_field_indexed($field) { if (ENVIRONMENT === 'development') { $this->load->helper('array'); $fields = pluck($this->_get_table_info(), 'Key', 'Field'); if (isset($fields[$field]) && empty($fields[$field])) { // field has no index $this->firephp->warn('Field \'' . $field . '\' in table \'' . $this->get_table() . '\' has no index!'); } } }
private function _sent_notification_to_parent($album_id) { $album_childs = $this->album_model->getTaggedChildren($album_id); $child_ids = pluck($album_childs, 'id'); $this->load->model('parents/parents_model'); $parent_ids = $this->parents_model->allAssocParents($child_ids); $child_parent = array(); foreach ($parent_ids as $value) { $child_parent[$value->child_id][] = $value->parent_id; } foreach ($album_childs as $album_child) { if (!empty($album_child->item_hash)) { $child_item_image = $album_child->item_hash; $img = glob("uploads/child/*{$child_item_image}.*", GLOB_BRACE); if (isset($img['0'])) { $child_item_image = $img['0']; } else { $child_item_image = 'uploads/album_item/' . $item_info->item; } } else { $child_item_image = 'uploads/album_item/' . $album_child->item; } $feed_image = $album_child->type == 'photo' ? $child_item_image : 'video-play.jpg'; $activity = array('from' => $this->current_user->first_name . ' ' . $this->current_user->last_name, 'title' => get_display_name($album_child->name, $album_child->alias) . ' has been tagged in Gallery.', 'description' => '', 'image' => $feed_image, 'date_time' => date("Y-m-d H:i:s"), 'link' => 'gallery', 'child_id' => $album_child->id); $insert_id_activity = $this->album_model->insertRow($activity, IMS_DB_PREFIX . 'activity_feed'); if (isset($child_parent[$album_child->id]) and !empty($child_parent[$album_child->id])) { $data = array(); foreach ($child_parent[$album_child->id] as $parent_id) { $data[] = array('activity_feed_id' => $insert_id_activity, 'parent_id' => $parent_id, 'read' => 0); } $this->album_model->insertRows($data, IMS_DB_PREFIX . 'activity_feed_user'); $this->send_push_notification_child($album_child->id, array_merge(array('type' => 'album_tag', 'child_id' => $album_child->id), $activity)); } } }
public function getSubjectCoordinatorsIds($subject_id, $yearterm_id) { $subject_coordinators = $this->db->select('sc_id')->from(IMS_DB_PREFIX . 'sc_subject')->where('subject_id', $subject_id)->where('concat(year,term)', $yearterm_id)->get()->result(); return pluck($subject_coordinators, 'sc_id'); }
/** * Get (all) root nodes. */ public function get_root() { $this->db->select('r.descendant'); $this->db->from($this->closure_table . " r"); $this->db->join($this->closure_table . " p", "r.descendant = p.descendant AND p.ancestor <> p.descendant", "LEFT"); $this->db->where('p.descendant IS NULL', NULL); $result = $this->db->get(); if ($result) { return pluck($result->result(), 'descendant'); } else { return false; } }
public function delete_global_elements_for_page($page_id, $layout) { $this->load->helper('array'); $global_elements = $this->get_global_elements_for_layout($layout); if (!empty($global_elements)) { $global_element_ids = pluck($global_elements, 'element_id'); $this->db->where_in('element_id', $global_element_ids); $this->db->where('page_id', $page_id); $this->db->delete('element_x_page'); } }
public function send_notification_to_approvers($lesson_record_id, $approvers, $level_name, $subject_name, $date_time) { if (empty($approvers)) { return false; } // debug($approvers,'approvers'); $temp_approvers = $approvers; $approvers = array(); foreach ($temp_approvers as $key => $approver) { $approvers[] = $approver; } $lesson_record = $this->lesson_record_model->getLessonRecord($this->selected_year_term_id, $lesson_record_id); $lesson_record_classes_email = $this->lesson_record_model->getLessonRecordClasses($this->selected_year_term_id, $lesson_record_id, 0); if ($lesson_record_classes_email != '') { $classes_name = array(); foreach ($lesson_record_classes_email as $lesson_record_class) { $classes_name[] = $lesson_record_class->class_name; } $class_name = empty($lesson_record_class) ? '' : join(',', $classes_name); $this->data['classes_name'] = $class_name; } $term_email = $lesson_record->term; $level_name_email = $lesson_record->level_name; $subject_name_email = $lesson_record->subject_name; $interval_name_email = $lesson_record->interval_name; $teacher_name = $this->current_user->first_name . " " . $this->current_user->last_name; if (!empty($lesson_record_classes_email)) { $subject = 'Subject (' . $subject_name_email . ') Term (' . $term_email . ') Interval (' . $interval_name_email . ") Level-Class (" . $level_name_email . '-' . $class_name . ') Lesson Record Submitted by ' . $teacher_name; } else { $subject = 'Subject (' . $subject_name_email . ') Term (' . $term_email . ') Interval ( ' . $interval_name_email . ") Level-Class (" . $level_name_email . ') Lesson Record Submitted by ' . $teacher_name; } $message_template = '<p>Please note that the above lesson record has been submitted for your approval.</p>' . '<p>Please click on the link below to view the lesson record. You will be asked to login if you<br>have not already done so.<br><a href="{{destination_url}}">{{destination_url}}</a><br>Please copy the link and paste it to your browser if the link does not work properly.</p>'; $to = $approvers[0]; $cc = array_slice($approvers, 1); $cc = pluck($cc, 'email'); // debug_continue($to); // debug($cc); $loID = $lesson_record_id; $teacher_id = $this->current_user->id; $url = site_url('system?doThing=retrieveLessonRecord&loID=' . $loID . '&teacherID=' . $teacher_id); $message = str_replace('{{destination_url}}', $url, $message_template); $this->send_mail($to->email, $to->first_name, $subject, $message, $cc); // foreach ($approvers as $approver) { // $loID = $lesson_record_id; // $teacher_id = $this->current_user->id; // $url = site_url('system?doThing=retrieveLessonRecord&loID='.$loID.'&teacherID='.$teacher_id); // $message = str_replace('{{destination_url}}', $url, $message_template); // $this->send_mail($approver->email, $approver->first_name, $subject, $message); // } }
function index($offset = 0) { if ($this->input->is_ajax_request()) { $this->data['can_edit'] = (!_is('Supervisor') and !_is('Teacher')); $perpage = $this->get_per_page(); $module = 'Kin'; if ($this->input->get('_sorting_field')) { $sort = $this->sort_by($this->input->get('_sorting_field'), $module); } else { $sort = NULL; } // Searching feature starts from here if ($this->input->post('search_word') !== false) { $search = array(); $search_word = trim($this->input->post('search_word')); $search['word'] = $search_word; $this->session->set_userdata($module . '_search_word', $search_word); $search['words'] = explode(' ', $search_word); $search['fields'] = array('full_name', 'id_key', 'mobile_no', 'email'); $this->data['filter'] = 'yes'; } else { if ($this->input->get('filter') == 'yes') { if ($this->session->userdata($module . '_search_word')) { $search = array(); $search_word = $this->session->userdata($module . '_search_word'); $search['word'] = $search_word; $search['fields'] = array('full_name', 'id_key', 'mobile_no', 'email'); $this->data['filter'] = 'yes'; } else { $search = NULL; } } else { $search = NULL; } } // Searching ends here $kins = $this->kin_model->get_kins($offset, $perpage, $sort, $search); // debug_continue($kins, 'kinds'); if ($search) { $this->data['records_found'] = $kins['total']; } $kins_ids = pluck($kins['kins'], 'id'); if (!empty($kins_ids)) { $child_kins = $this->kin_model->get_child_of_kin($kins_ids); } else { $child_kins = array(); } $new_child_kin = array(); if (!empty($child_kins)) { foreach ($child_kins as $child_kin) { $new_child_kin[$child_kin->kin_id][] = $child_kin; } } $this->paginate($perpage, $kins['total'], "kin/index", 3); $this->data['child_kins'] = $new_child_kin; $this->data['kins'] = $kins['kins']; $this->data['search'] = $search; $this->data['sort'] = $sort; $this->data['id_from_variable'] = $this->variables_model->getVariablesIdType('child'); $this->data['id_from_variable_subscriber'] = $this->variables_model->getVariablesIdType('subscriber'); $nations = $this->variables_model->getVariables('nationality'); $races = $this->variables_model->getVariables('races'); $relations = $this->variables_model->getVariables('kins_relation'); $this->data['relations'] = $relations['allVariables']; $this->data['races'] = $races['allVariables']; $this->data['nations'] = $nations['allVariables']; $this->load->view('kin_list', $this->data); } else { $this->ims_template->build('parent_account/blank', $this->data); } }
public function index() { if ($this->input->is_ajax_request()) { $this->breadcrumb->append_crumb(lang('view_print_sow')); $year_term = year_term($this->selected_year_term_id); if (_is('Teacher')) { $all_levels = $this->levels_model->getTeacherLevels($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id); } else { if (_is('Level Coordinator')) { $all_levels = $levels = $this->levels_model->getLCLevel($this->current_user->id, $this->selected_year_term_id); } else { $all_levels = $this->Sow_model->order_by('sequence')->getWhere(array('archive' => 0), IMS_DB_PREFIX . 'level'); } } if ($this->input->post('class_dropdown')) { $this->data['level_id'] = $level_id = $this->input->post('class_dropdown'); } else { if ($all_levels and isset($all_levels[0])) { $this->data['level_id'] = $level_id = $all_levels[0]->id; } else { $this->data['level_id'] = $level_id = 0; } } if (_is('Subject Coordinator')) { $curent_centre_subjects = $this->subject_model->getSCSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id); } else { if (_is('Teacher')) { $curent_centre_subjects = $this->subject_model->getTeacherSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id, $level_id); } else { if (_is('Master Admin') and MASTER_FREE) { $curent_centre_subjects = $this->subject_model->getCenterSubjects(NULL); } else { $curent_centre_subjects = $this->subject_model->getCenterSubjects($this->current_centre_role->centre_id); } } } $subject_ids = pluck($curent_centre_subjects, 'id'); if ($this->input->post('subjects_dropdown') and in_array($this->input->post('subjects_dropdown'), $subject_ids)) { $this->data['subject_id'] = $subject_id = $this->input->post('subjects_dropdown'); } else { if ($curent_centre_subjects and isset($curent_centre_subjects[0])) { $this->data['subject_id'] = $subject_id = $curent_centre_subjects[0]->id; } else { $this->data['subject_id'] = $subject_id = 0; } } $themes = $this->subject_Model->get_all_themes($subject_id); $areas = $this->subject_Model->get_sub_areas($subject_id); $periods = $this->Sow_model->getPeriods($year_term['year'], $year_term['term'], $subject_id, $level_id); $sows_list = ($subject_id and $level_id) ? $this->Sow_model->getSows($subject_id, $level_id, $this->selected_year_term_id) : array(); $sow_ids = array(); $sows = array(); foreach ($sows_list as $sow) { $sow_ids[] = $sow->id; $sows[$sow->id] = $sow; } $tasks = empty($sow_ids) ? array() : $this->Print_sow_model->getTasksInSows($sow_ids); foreach ($tasks as $task) { if (isset($sows[$task->sow_id])) { $sows[$task->sow_id]->tasks[] = $task; } } if (!empty($sows)) { foreach ($sows as $sow) { $groupedsow[$sow->year_term_interval_id][$sow->id] = $sow; } } else { $groupedsow = array(); } $slos = $this->Sow_model->getAllAssocSlo($this->selected_year_term_id, $level_id, $subject_id); $assesment_rubrics = $this->Sow_model->getAssesRubric($subject_id, $level_id, $this->selected_year_term_id); $new_periods_with_sows = array(); foreach ($assesment_rubrics as $assesment_rubric) { $new_assessment[$assesment_rubric->asses_id][] = $assesment_rubric; } if (empty($new_assessment)) { $new_assessment = array(); } $this->data['areas'] = $areas; $this->data['themes'] = $themes; $this->data['assessment_rubrics'] = $new_assessment; $this->data['AssocSlos'] = $slos; $this->data['periods'] = $periods; $this->data['sows'] = $groupedsow; $this->data['year'] = $year_term['year']; $this->data['term'] = $year_term['term']; $this->data['all_levels'] = $all_levels; $this->data['current_centre_subjects'] = $curent_centre_subjects; $this->load->view('view_print_sow', $this->data); } else { $this->ims_template->build('parent_account/blank', $this->data); } }
public function __construct() { parent::__construct(); $this->load->model('options_model'); $language_setting = $this->options_model->getOption('language_setting'); if (isset($language_setting) && !empty($language_setting)) { $this->language = $language_setting['language']; $this->lang->load(strtolower(get_class($this)), $this->language); $this->lang->load($this->language, 'common/' . $this->language); } else { $this->language = "english"; $this->lang->load(strtolower(get_class($this)), $this->language); $this->lang->load($this->language, 'common/' . $this->language); } global $current_language; $current_language = $this->language; $this->load->library('syraz_auth', IMS_DB_PREFIX . 'parent'); /**------------------------------------------- * set login mode to parent. | **------------------------------------------- * * Use login 'system' to set it to system login. * By default it will use 'system' login * */ $this->syraz_auth->set_login_mode('parent'); /* * while loggin in with social api CI Session data disappearing on new request * (@session not persisting), So used native session to check login status on parent account whether there is a login. * */ session_start(); if (isset($_SESSION['user_id']) && $_SESSION['user_id']) { $this->session->set_userdata(array('parent_user_id' => $_SESSION['user_id'], 'login_hash_parent' => md5(IMS_DB_PREFIX . 'parent'))); $this->syraz_auth->set_session($_SESSION['user_id']); unset($_SESSION['user_id']); } if (!$this->syraz_auth->logged_in()) { if ($this->input->is_ajax_request()) { echo "<script type='text/javascript'>\$(function(){window.location='" . site_url('home') . "';});</script>"; exit; } else { redirect(site_url('home')); } } $this->load->model(array('admin_common_model', 'parent_account/parent_account_model', 'api/api_model')); // $this->output->enable_profiler(TRUE); $this->data['current_parent'] = $this->current_parent = $this->parent_account_model->getFromId($this->syraz_auth->parent_user_id()); $this->data['childrens'] = $this->parent_account_model->getChildList($this->current_parent->id); if (!$this->session->userdata('selected_child_id')) { $this->session->set_userdata('selected_child_id', !empty($this->data['childrens']) ? $this->data['childrens'][0]->id : 0); } $child_ids = pluck($this->data['childrens'], 'id'); $this->data['selected_child_id'] = $this->selected_child_id = $this->session->userdata('selected_child_id'); if ($this->input->get('child') and in_array($this->input->get('child'), $child_ids)) { $this->data['selected_child_id'] = $this->selected_child_id = $this->input->get('child'); $this->session->set_userdata('selected_child_id', $this->selected_child_id); } $this->data['subscriber_details'] = $this->parent_account_model->getParentById($this->session->userdata('parent_user_id')); // debug($this->data['subscriber_details']); $year_terms = $this->parent_account_model->getChildYearTerms($this->data['selected_child_id']); $this->data['year_terms'] = array(); $default_year_term = $default_year_term_for_parents_curriculum = $default_year_term_for_parents_progress_report = 0; foreach ($year_terms as $year_term) { $this->data['year_terms'][$year_term->year][] = $year_term; if ($year_term->default == '1') { $default_year_term = $year_term->id; } if ($year_term->default_year_term_for_parents_curriculum == '1') { $default_year_term_for_parents_curriculum = $year_term->id; } if ($year_term->default_year_term_for_parents_progress_report == '1') { $default_year_term_for_parents_progress_report = $year_term->id; } } $this->default_yearterm_id = $default_year_term; $this->default_year_term_for_parents_curriculum = $default_year_term_for_parents_curriculum; $this->default_year_term_for_parents_progress_report = $default_year_term_for_parents_progress_report; if (!$this->session->userdata('parent_selected_year_term_id')) { $this->session->set_userdata('parent_selected_year_term_id', $default_year_term == 0 ? isset($year_terms[0]) ? $year_terms[0]->id : 0 : $default_year_term); } if (!$this->session->userdata('selected_year_term_id_for_progress_report')) { $this->session->set_userdata('selected_year_term_id_for_progress_report', $default_year_term_for_parents_progress_report == 0 ? isset($year_terms[0]) ? $year_terms[0]->id : 0 : $default_year_term_for_parents_progress_report); } if (!$this->session->userdata('selected_year_term_id_for_curriculum')) { $this->session->set_userdata('selected_year_term_id_for_curriculum', $default_year_term_for_parents_curriculum == 0 ? isset($year_terms[0]) ? $year_terms[0]->id : 0 : $default_year_term_for_parents_curriculum); } $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('parent_selected_year_term_id'); $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id); $this->data['selected_year_term_id_for_curriculum'] = $this->selected_year_term_id_for_curriculum = $this->session->userdata('selected_year_term_id_for_curriculum'); $this->data['selected_year_term_for_curriculum'] = $this->selected_year_term_for_curriculum = year_term($this->selected_year_term_id_for_curriculum); $this->data['selected_year_term_id_for_progress_report'] = $this->selected_year_term_id_for_progress_report = $this->session->userdata('selected_year_term_id_for_progress_report'); $this->data['selected_year_term_for_progress_report'] = $this->selected_year_term_for_progress_report = year_term($this->selected_year_term_id_for_progress_report); $segment = $this->uri->segment(2); switch ($segment) { case 'progress_report': $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->selected_year_term_id_for_progress_report; $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id_for_progress_report); break; case 'curriculum': $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->selected_year_term_id_for_curriculum; $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id_for_curriculum); break; default: $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('parent_selected_year_term_id'); $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id); } if ($this->selected_child_id != 0 and $this->selected_year_term_id != 0) { $this->data['selected_child'] = $this->parent_account_model->getChildDetails($this->selected_child_id, $this->selected_year_term_id); $access = true; } else { if ($this->selected_child_id != 0) { $this->data['selected_child'] = $this->parent_account_model->select('*,child_image as latest_child_image')->getFromId($this->selected_child_id, 'id', IMS_DB_PREFIX . 'child'); } } /** * Do not show year-term in following controllers */ $hidden_year_term = array('gallery', 'settings', 'parent_account'); $current_controller = isset($segment) && $segment ? $segment : $this->uri->segment(1); $this->data['is_hidden_yt'] = in_array($current_controller, $hidden_year_term); if (!isset($access) and ($this->router->fetch_class() != 'parent_account' or !in_array($this->router->fetch_method(), array('settings', 'add_parent_child_relation', 'change_children', 'delete_child_relation', 'change_parent_password', 'change_email_notification_status')))) { redirect(site_url('parent_account/settings')); } $parent_portal_setting = $this->options_model->getOption('parent_portal_setting'); if (!empty($parent_portal_setting)) { $this->data['parent_portal_setting'] = $parent_portal_setting; } else { $this->data['parent_portal_setting'] = array(); } $this->data['unread_activity_feeds'] = $this->parent_account_model->getUnReadActivitiesFeed($this->current_parent->id); $this->ims_template->enable_parser(FALSE)->set_theme('parent')->set_layout('default')->title('Parents\' Portal')->set_partial('head')->set_partial('header')->set_partial('sidebar')->set_partial('footer'); $this->data['theme_path'] = 'themes/parent/'; $this->breadcrumb->append_crumb(lang('dashboard'), site_url('parent_account')); $this->load->model(array('admin_common_model')); $this->progress_report_year_term = $this->admin_common_model->getProgressReportYearTerm(); $this->curriculum_year_term = $this->admin_common_model->getCurriculumYearTerm(); }
public function print_consolidated_assessment() { if (empty($_GET)) { $this->_set_flashdata(lang('print_assessment_no_param'), 'error'); redirect(site_url('assessment_view')); } $subject_id = $this->input->get('subject_id', true); $assessment_category_id = $this->input->get('assessment_category_id', true); $_year_term = $this->selected_year_term_id; $levels = $this->levels_model->getLevels(); if (empty($subject_id) && empty($assessment_category_id) && empty($_year_term)) { $this->_set_flashdata(lang('print_assessment_invalid_param'), 'error'); redirect(site_url('assessment_view')); } $this->data['subject'] = $this->subject_model->getSubjectById($subject_id); if (_is('Teacher')) { $this->data['levels'] = $levels = $this->levels_model->getTeacherLevels($this->current_user->id, $_year_term, $this->current_centre_role->centre_id); $in_level = pluck($levels, 'id'); } else { if (_is('Level Coordinator')) { $this->data['levels'] = $levels = $this->levels_model->getLCLevel($this->current_user->id, $_year_term); $in_level = pluck($levels, 'id'); } else { $this->data['levels'] = $levels = $this->assessment_view_model->order_by('sequence')->getWhere(array('archive' => 0), IMS_DB_PREFIX . 'level'); $in_level = NULL; } } if (_is('Subject Coordinator')) { $this->data['subjects'] = $this->subject_model->getSCSubjects($this->current_user->id, $_year_term, $this->current_centre_role->centre_id); } else { if (_is('Teacher')) { $this->data['subjects'] = $this->subject_model->getTeacherSubjects($this->current_user->id, $_year_term, $this->current_centre_role->centre_id, 0); } else { if (_is('Master Admin') and MASTER_FREE) { $this->data['subjects'] = $this->subject_model->getCenterSubjects(NULL); } else { $this->data['subjects'] = $this->subject_model->getCenterSubjects($this->current_centre_role->centre_id); } } } $this->data['rubric_groups'] = $this->assessment_view_model->order_by('sequence')->getWhere(array('subject_id' => $subject_id), IMS_DB_PREFIX . 'rubric_group'); $rubrics = $this->assessment_view_model->order_by('sequence')->getRubrics($subject_id); $this->data['rubrics'] = array(); foreach ($rubrics as $rubric) { $this->data['rubrics'][$rubric->rubric_group_id][] = $rubric; } $this->data['assessment_categories'] = $this->assessment_view_model->order_by('sequence')->getWhere(array('subject_id' => $subject_id), IMS_DB_PREFIX . 'assessment_category'); $this->data['assessments'] = $this->assessment_view_model->getAssessmentConLevel($subject_id, $assessment_category_id, $_year_term, $in_level); $assessments_rubrics = $this->assessment_view_model->getRubricAssessment($subject_id); $this->data['assessments_rubrics'] = array(); foreach ($assessments_rubrics as $assessments_rubric) { $this->data['assessments_rubrics'][$assessments_rubric->assessment_id][] = $assessments_rubric; } $assessments_levels = $this->assessment_view_model->getLevelAssessment($subject_id); $this->data['assessments_levels'] = array(); foreach ($assessments_levels as $assessments_level) { $this->data['assessments_levels'][$assessments_level->assessment_id][] = $assessments_level; } $consolidate_assessment_rubric = $this->data['assessments_rubrics']; $consolidate_assessment_levels = $this->data['assessments_levels']; $consolidate_assessments = $this->data['assessments']; $b = array(); if (isset($consolidate_assessments) && $consolidate_assessments) { foreach ($consolidate_assessments as $assessment) { if (isset($consolidate_assessment_levels[$assessment->id]) and count($consolidate_assessment_levels[$assessment->id]) > 0) { foreach ($consolidate_assessment_levels[$assessment->id] as $assessments_level) { $a = array(); $a[$assessments_level->name] = array(); $a[$assessments_level->name]['id'] = $assessment->id; $a[$assessments_level->name]['name'] = $assessment->name; $a[$assessments_level->name]['rubric'] = array(); if (isset($consolidate_assessment_rubric[$assessment->id]) and count($consolidate_assessment_rubric[$assessment->id]) > 0) { $i = 0; foreach ($consolidate_assessment_rubric[$assessment->id] as $assessments_rubric) { $a[$assessments_level->name]['rubric'][$i] = $assessments_rubric->name . "<br>"; $i++; } } if (array_key_exists($assessments_level->name, $b)) { array_push($b[$assessments_level->name], $a); } else { $b[] = $a; } } } } } $printable = array(); foreach ($levels as $level) { $printable[$level->name] = null; } if (!empty($b)) { foreach ($b as $k => $v) { $key = key($v); $printable[$key][] = $v[$key]; } } $this->data['printable'] = array_filter($printable); $this->data['all_year_term'] = $this->data['year_terms']; $this->load->view('template/assessment_view_download', $this->data); // $file_name = "assessment_view_" . $subject_id . '_' . $_year_term . ".pdf"; // $html = $this->load->view('template/assessment_view_download', $this->data, true); // $this->load->library('pdf'); // $pdf = $this->pdf->load(); // // $pdf->WriteHTML($html); // write the HTML into the PDF // $pdf->Output($file_name, 'D'); }
public function add() { if ($this->input->post()) { if ($this->_validate_add_feedback()) { $data = array('feedback' => $this->input->post('feedback'), 'date_time' => date('Y-m-d H:i:s'), 'update_time' => date('Y-m-d H:i:s'), 'status' => 0, 'child_id' => $this->data['selected_child']->id, 'subscriber_id' => $this->current_parent->id); $to = $this->input->post('slct_receiver'); switch ($to) { case 'to_center': // if($this->input->post('user_subject_id') == 'centre') { $data['centre_id'] = $this->data['selected_child']->centre_id; $data['group_id'] = '2'; // } else { // $data['user_id'] = $this->input->post('user_subject_id'); // $data['centre_id'] = $this->data['selected_child']->centre_id; // } break; case 'to_teacher': $data['centre_id'] = $this->data['selected_child']->centre_id; $teacher_subject = explode('/', $this->input->post('user_subject_id')); $data['user_id'] = $teacher_subject[0]; if (!empty($teacher_subject[1])) { $data['subject_id'] = $teacher_subject[1]; } break; // case 'to_sc': // $data['subject_id'] = $this->input->post('user_subject_id'); // $data['group_id'] = 'subject coordinator'; // break; // case 'to_sc': // $data['subject_id'] = $this->input->post('user_subject_id'); // $data['group_id'] = 'subject coordinator'; // break; case 'to_others': default: $data['group_id'] = $this->input->post('user_subject_id'); break; } $this->Feedback_model->insertRow($data); redirect('feedback'); } } $this->load->model('subject/subject_model'); //$this->data['subjects'] = $this->subject_model->getCenterSubjects($this->data['selected_child']->centre_id); //fetching class teachers only $class_teachers = $this->Feedback_model->getSubjectTeachersforChild($this->data['selected_child_id'], $this->default_yearterm_id, $this->data['selected_child']->current_centre_id); //plucking teacher id only $class_teachers_ids = pluck($class_teachers, 'id'); //fetching form teacher only $form_teachers = $this->Feedback_model->getFormTeachersForChild($this->data['selected_child_id'], $this->default_yearterm_id, $this->data['selected_child']->current_centre_id); foreach ($form_teachers as $key => &$form_teacher) { if (!in_array($form_teacher->id, $class_teachers_ids)) { $form_teacher->subject_id = 0; $form_teacher->subject_name = "Form Teacher"; $class_teachers[] = $form_teacher; } } $this->data['teachers'] = $class_teachers; // $this->data['centre_admins'] = $this->Feedback_model->getCenterUsers4ChildByRoleIds($this->data['selected_child_id'], array(2, 7)); $this->data['others'] = $this->Feedback_model->getWhere(array('status' => 1), IMS_DB_PREFIX . 'feedback_group'); if ($this->input->is_ajax_request()) { $this->load->view('add_feedback', $this->data); } else { $this->ims_template->build('parent_account/blank', $this->data); } }
protected function send_push_notification_child($child_id, $message) { $devices = $this->admin_common_model->getAllDevices($child_id); if ($devices) { $registatoin_ids = pluck($devices, 'push_token'); $this->config->load("google_push_notification", TRUE); $gpn_config = $this->config->item('google_push_notification'); $this->load->library('google_push_notification', $gpn_config); $this->google_push_notification->send($registatoin_ids, $message); } }
function type_gcd($arr) { $type = type_check($arr[0]); if (is_numeric($arr[0])) { $highestMagnitude = abs($arr[0]); $fp = is_float($arr[0]); $sign = $arr[0] < 0; for ($i = 1; $i < count($arr); ++$i) { if (!is_numeric($arr[$i])) { throw new Exception('Received a non-numeric value in an array of numbers.'); } if (abs($arr[$i]) > $highestMagnitude) { $highestMagnitude = abs($arr[$i]); } if (is_float($arr[$i])) { $fp = true; } if ($arr[$i] < 0) { $sign = true; } } return type_check(($sign ? -1 : 1) * $highestMagnitude, $fp); } else { if ($type === 0x80) { $comb = array(); foreach ($arr as $v) { foreach ($v as $u) { $comb[] = $u; } } return array(type_gcd($comb)); } else { if ($type === 0x9) { $ret = array(); foreach ($arr[0] as $k => $v) { $ret[$k] = type_gcd(pluck($arr, $k)); } return $ret; } else { if ($type === 0x1b) { $ret = array(); foreach (get_object_vars($arr[0]) as $k => $v) { $ret[$k] = type_gcd(pluck($arr, $k)); } return $ret; } else { if ($type === 0x21) { $type = 0x20; } for ($i = 1; $i < count($arr); ++$i) { $thisType = type_check($arr[$i]); if ($thisType === 0x21) { $thisType = 0x20; } if ($thisType !== $type) { throw new Exception('Type mismatch.'); } } return $type; } } } } }