public function get_names() { $temp_subject = new Subject(); $temp_subject->load($this->subject_id_1); $this->subject_1_name = $temp_subject->print_name(); $temp_subject->load($this->subject_id_2); $this->subject_2_name = $temp_subject->print_name(); }
public function return_subject_name() { $sub = new Subject(); $sub->load($this->return_subject_id()); return $sub->name; }
* @link http://www.ianmonroe.com * @since File included in initial release * */ if (!isset($APP)) { die; } $current_subject = new Subject(); $current_aspect_group = new AspectGroup(); // $default_controller = $APP['controller_path'].'/aspect_controller.php'; $default_controller = 'src/controllers/aspect_controller.php'; $post_data = 'action: "add_aspect_to_subject"'; $id = NULL; if (isset($_GET['id'])) { $id = (int) trim($_GET['id']); $current_subject->load($id); $current_aspect_group->load($current_subject->get_aspect_group_id()); } ?> <form class="form-horizontal" id="new_aspect_form" enctype="multipart/form-data"> <fieldset> <!-- Form Name --> <legend>Add a new Aspect</legend> <input name="subject_id" type="hidden"
$default_controller = $APP['controller_path'] . '/subject_controller.php'; $relationship_controller = $APP['controller_path'] . '/relationship_controller.php'; $constraint = NULL; $id = NULL; if (isset($_GET['constraint'])) { $constraint = trim($_GET['constraint']); } if (isset($_GET['id'])) { $id = (int) trim($_GET['id']); } $post_data = 'action: "view_subject", constraint:"id"'; if ($id) { $post_data .= ', id:"' . $id . '"'; } $current_subject = new Subject(); $current_subject->load((int) $id); // $current_subject->load_aspects(); // $current_subject->load_relationships(); ?> <div class="col-xs-12" id="main_view"> <?php echo preloader(); ?> </div> <div id="new_relationship_form"> <h4>New Relationship</h4> <form class="form-inline" id="new_rel_form">
$output .= 'filename: ' . $handle->file_src_name . PHP_EOL; $output .= 'path: ' . $app['uploads_path'] . PHP_EOL; $newfilename = $handle->file_src_name_body . '_upload' . strtotime("now"); $final_filename = $newfilename . '.' . $handle->file_src_name_ext; $output .= 'final filename: ' . $final_filename . PHP_EOL; $handle->file_new_name_body = $newfilename; $handle->process($app['uploads_path']); if ($handle->processed) { $file_location = $final_filename; $handle->clean(); } else { $output .= 'error : ' . $handle->error . PHP_EOL; } } $current_subject = new Subject(); $current_subject->load((int) $_POST['subject_id']); $new_aspect = new Aspect(); $new_aspect->aspect_type = (int) $_POST['aspect_type']; if (isset($file_location)) { $new_aspect->aspect_data = $file_location; } else { $new_aspect->aspect_data = $_POST['aspect_data']; } $new_aspect->aspect_binary = NULL; $new_aspect->predicted_accuracty = NULL; $new_aspect->aspect_notes = $_POST['aspect_notes']; $new_aspect->aspect_source = $_POST['aspect_source']; $new_aspect->save(); $current_subject->add_aspect($new_aspect); $output .= 'Added ' . $new_aspect->return_aspect_type_name() . ' to ' . $current_subject->name . '.'; echo $output;
public function write_aspect() { $new_aspect = new Aspect(); $new_aspect->aspect_type = ''; $new_aspect->aspect_data = $this->result; $new_aspect->aspect_source = 'Wikipedia API results'; $new_aspect->markdown = 0; $new_aspect->is_hidden = 1; $new_aspect->save(); $new_subject = new Subject(); $new_subject->load($this->subject_id); $new_subject->add_aspect($new_aspect); $new_subject->update(); }
protected function gettimetablecreate() { global $user; global $objPDO; $student = new student($objPDO, $user->getuserId()); $headMenu = array("username" => $student->getName()); if ($user->checkAdmin() == true && isset($_GET['uid'])) { include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/examination_section_subject_class.php'; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/examination_class.php'; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_class.php'; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php'; $exam_id = $_GET['uid']; $exam = new Examination($objPDO, $exam_id); $slots = $exam->getFnAn(); if ($slots == 2) { $slots = 1; } else { if ($slots == 3) { $slots = 2; } else { $slots = 1; } } $startTime = strtotime($exam->getStartDate()); $endTime = strtotime($exam->getEndDate()); $day = 86400; $format = 'd-m-Y'; $numDays = round(($endTime - $startTime) / $day) + 1; $days = array(); for ($i = 0; $i < $numDays; $i++) { $days[] = date($format, $startTime + $i * $day); } $rel = new ExaminationSectionSubject($objPDO); $section_array = $rel->getByExamId($exam_id); $section_name = array(); $subject_array = array(); $section = new Section($objPDO); $subject = new Subject($objPDO); foreach ($section_array as $key => $value) { $section->setID($key); $section->load(); $section_name[$key] = $section->getCode(); foreach ($value as $k => $v) { $subject->setID($v); $subject->load(); $subject_array[$key][$v] = $subject->getName(); } $subject_array[$key][0] = "--None--"; } include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/exam_timetable_create.php'; } else { header('Location:http://localhost/cloud'); } }
$q = $_POST['query']; $db = Database::get_instance(); $query = $db->prepare("SELECT id, subject_name, date_updated FROM subjects WHERE subject_name LIKE ? ORDER BY subject_name"); $data = array('%' . $q . '%'); if ($query->execute($data)) { while ($row = $query->fetch()) { $output .= '<p><a href="index.php?p=subject_view&id=' . $row['id'] . '">' . $row['subject_name'] . '</a><br /><span class="small">Updated: ' . $row['date_updated'] . '</span></p>'; } } // Next, see if the query appears in any aspects, and return the Subject if that's the case. $aspect_q = $db->prepare("SELECT * FROM aspects INNER JOIN aspect_types ON aspects.aspect_type=aspect_types.id INNER JOIN subjects_aspects ON aspects.id=subjects_aspects.aspect_id WHERE aspect_data LIKE ?"); if ($aspect_q->execute($data)) { $output .= "<h3>Aspect Results:</h3>"; while ($row = $aspect_q->fetch()) { $ts = new Subject(); $ts->load($row['subject_id']); $output .= '<p>'; $output .= 'Found in an aspect of ' . $ts->print_name(); $output .= '</p>'; } } // finally, let's query the web. $ddg = new DuckAgent(); $ddg->query($q); if (!empty($ddg->result)) { $output .= '<h3>From the web:</h3>'; $websearch = json_decode($ddg->result, true); if (isset($websearch['AbstractText'])) { $output .= '<p>Abstract: ' . $websearch['AbstractText'] . '<br /> <span class="small">Source: ' . $websearch['AbstractSource'] . '</span></p>'; } if (!empty($websearch['Definition'])) {