/** * Authenticates a dummy user. * @return boolean always true. */ public function authenticate() { $student = Student::model()->findByAttributes(array('username' => $this->username)); if ($student === null) { $student = new Student(); $faculty = Faculty::model()->findByPk(1); if ($faculty === null) { $faculty = new Faculty(); $faculty->id = 1; $faculty->name = 'Dummy Faculty'; $faculty->save(false); } $student->username = $this->username; $student->name = $this->name; $student->is_admin = $this->isAdmin; $student->faculty_id = $faculty->id; $student->photo = Yii::app()->params['defaultProfilePhoto']; } $student->last_login_timestamp = date('Y-m-d H:i:s'); $student->save(); $this->id = $student->id; $this->name = $student->name; $this->setState('isAdmin', $student->is_admin); $this->setState('profilePhoto', $student->photo); return true; }
/** * Displays the update profile page of a student. * @param integer $id the student id */ public function actionUpdate($id) { $model = $this->loadModel($id); if (isset($_POST['Student'])) { $model->attributes = $_POST['Student']; if ($model->validate()) { $photo = CUploadedFile::getInstance($model, 'file'); if ($photo !== null) { $savePath = Yii::app()->params['photosDir']; if ($model->photo != Yii::app()->params['defaultProfilePhoto']) { unlink($savePath . $model->photo); } Yii::import('ext.randomness.*'); $fileName = Randomness::randomString(Student::MAX_FILENAME_LENGTH - strlen($photo->extensionName) - strlen('' + $model->id) - 1); $fileName = $fileName . $model->id . '.' . $photo->extensionName; $photo->saveAs($savePath . $fileName); $model->photo = $fileName; Yii::app()->user->setState('profilePhoto', $fileName); } $model->save(false); Yii::app()->user->setName($model->name); Yii::app()->user->setNotification('success', 'Profil berhasil diubah.'); } else { Yii::app()->user->setNotification('danger', 'Terdapat kesalahan pengisian.'); } } $this->render('update', array('model' => $model, 'faculties' => Faculty::model()->findAll())); }
function search() { include_once "faculty.php"; $obj = new Faculty(); $txt = $_REQUEST['txt']; if (!$obj->search($txt)) { echo '{"result":0, "message":"Searched Item does not exists"}'; return; } $row = $obj->fetch(); echo '{"result":1,"faculties":['; while ($row) { echo json_encode($row); $row = $obj->fetch(); if ($row) { echo ","; } } echo "]}"; }
private function getRealData(Faculty $faculty, $formData, $facultyName = '') {/*{{{*/ if($facultyName) { $hfName = $facultyName; } else { $hfName = $faculty->name; } $res = array( 'key' =>$hfName, 'title'=>XString::truncate($hfName.'_推荐医院_常见疾病_好大夫在线', 60, '...'), 'url'=>$faculty->getUrl(), 'showurl'=>'http://www.haodf.com', 'pagesize'=>rand(58, 62).'K', 'date'=>date('Y-m-d', time()), 'content'=>"根据".$formData['allVoteCount']."位".$hfName."病患者投票得出的科室排行", 'link'=>$faculty->getFacultyUrl(), ); return array('item' => $res + $formData['form']); }/*}}}*/
public function actionGetFacultyInfo() { $this->retVal = new stdClass(); $request = Yii::app()->request; if ($request->isPostRequest && isset($_POST)) { try { $faculty_id = $request->getPost('faculty_id'); $faculty_data = Faculty::model()->findAllByAttributes(array('faculty_id' => $faculty_id)); $this->retVal->faculty_data = $faculty_data; } catch (exception $e) { $this->retVal->message = $e->getMessage(); } echo CJSON::encode($this->retVal); Yii::app()->end(); } }
public function createDepartment() { $validator = Validator::make(Input::all(), array('name' => 'required', 'shortname' => 'required', 'head' => 'required', 'description' => 'required', 'facultyId' => 'required|numeric')); if ($validator->fails()) { // If not inform user of errors. return Response::json(array('success' => false, 'errors' => $validator->messages())); } else { // Check user has permission to create department. if (Auth::user()->rank == 3) { // Now just create Department. $department = Departments::create(array('departmentname' => Input::get('name'), 'departmentshort' => Input::get('shortname'), 'departmenthead' => Input::get('head'), 'departmentdescription' => Input::get('description'), 'facultyid' => Input::get('facultyId'))); // Get faculty list so we can return with response. $faculties = Faculty::all(); // If not inform user of errors. return Response::json(array('success' => true, 'departmentId' => $department->departmentid, 'faculties' => $faculties)); } } }
/** * Run the database seeds. * * @return void */ public function run() { $users = [['f_name' => 'John', 'l_name' => 'Doe', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 13, 'department' => 'EEE', 'phone' => '+8801760099824'], ['f_name' => 'Jane', 'l_name' => 'Diana', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 7, 'department' => 'BBS', 'phone' => '+8801760099824'], ['f_name' => 'Martha', 'l_name' => 'Jane', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 10, 'department' => 'ESS', 'phone' => '+8801760099824'], ['f_name' => 'Jeffery', 'l_name' => 'Way', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 9, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Abdur', 'l_name' => 'Rahman', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 5, 'department' => 'SECS', 'phone' => '+8801760099824', 'role' => 'faculty'], ['f_name' => 'Atef', 'l_name' => 'Haque', 'email' => '*****@*****.**', 'password' => bcrypt('password'), 'semester_id' => 15, 'department' => 'EEE', 'phone' => '+8801760099824', 'role' => 'admin']]; $students = [['student_id' => '10101010', 'id' => 1, 'major' => 'EEE'], ['student_id' => '00701020', 'id' => 2, 'major' => 'BBS'], ['student_id' => '10212020', 'id' => 3, 'major' => 'ES']]; $faculties = [['id' => 4, 'faculty_id' => '05603012'], ['id' => 5, 'faculty_id' => '04050205']]; $admins = [['id' => 6, 'admin_id' => '04030204']]; foreach ($users as $key => $user) { User::create($user); } foreach ($students as $key => $student) { Student::create($student); } foreach ($faculties as $key => $faculty) { Faculty::create($faculty); } foreach ($admins as $key => $admin) { Admin::create($admin); } }
public function updateFaculty() { $validator = Validator::make(Input::all(), array('name' => 'required', 'shortname' => 'required', 'description' => 'required', 'id' => 'required')); if ($validator->fails()) { // If not inform user of errors. return Response::json(array('success' => false, 'errors' => $validator->messages())); } else { // Check user has permission to create faculty. if (Auth::user()->rank == 3) { // Load the Faculty. $faculty = Faculty::find(Input::get('id')); // Save changes. $faculty->facultyname = Input::get('name'); $faculty->facultyshort = Input::get('shortname'); $faculty->facultydescription = Input::get('description'); $faculty->save(); // If not inform user of errors. return Response::json(array('success' => true)); } } }
<?php namespace Ventus\Faculty; //============================================================================================ // Session, config //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('faculty', true); //============================================================================================ // Load the Model and L10N //============================================================================================ $user = new Faculty(); $faculty_profile = new UserProfile($dbo); if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) { $l10n->setLanguage($SESSION->corr_lang); \Locale::setDefault($SESSION->corr_lang); } $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Direct the course of what the user sees //============================================================================================ if (!isset($_GET['page'])) { if (isset($SESSION->email)) { header('Location: list-courses.php'); die; } else { $l10n->addResource(__DIR__ . '/l10n/index.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/index.php'; require_once FS_PHP . '/footer-external.php';
<?php include_once "faculty.php"; $id = $_REQUEST['fid']; $obj = new Faculty(); $obj->deleteFacultyById($id); header("location:facultyView.php");
/** * scans the input xml data and finds the "fachbereich" tags and writes them into db * * @param type $content */ private function processFaculties($content, $utilityService) { $insertedIds = array(); foreach ($content as $element) { $dataSrc = array(); foreach ($element->childNodes as $node) { if ($node->nodeName != '#text') { $data = $this->em->getRepository('DNTMBundle:Faculty')->findOneBy(array('id' => $node->getAttribute('id'))); if ($data == null) { $data = new Faculty(); $data->setId($node->getAttribute('id')); } $data->setName($node->getAttribute('bezeichnung')); if ($node->nodeName == 'fachgruppen') { foreach ($node->childNodes as $childNode) { if ($childNode->nodeName != '#text') { } } } if (!in_array($node->getAttribute('id'), $insertedIds)) { $insertedIds[] = $node->getAttribute('id'); $this->em->merge($data); } } } } $this->em->flush(); }
public function actionListTeacherFaculty() { $this->retVal = new stdClass(); $request = Yii::app()->request; if ($request->isPostRequest && isset($_POST)) { try { $listSubjectData = array('faculty_id' => StringHelper::filterString($_POST['faculty_id'])); $faculty_data = Faculty::model()->findAllByAttributes(array('faculty_id' => $listSubjectData['faculty_id'])); $teacher_data = Teacher::model()->findAllByAttributes(array('teacher_faculty' => $listSubjectData['faculty_id'])); $this->retVal->teacher_data = $teacher_data; $this->retVal->faculty_data = $faculty_data; $this->retVal->message = 1; } catch (exception $e) { $this->retVal->message = $e->getMessage(); } echo CJSON::encode($this->retVal); Yii::app()->end(); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Faculty the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Faculty::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function getArgs() { return array_replace_recursive(parent::getArgs(), ['labels' => ['all_items' => 'Authors'], 'public' => false, 'show_in_menu' => 'edit.php?post_type=' . ResearchAbstract::SLUG, 'has_archive' => false, 'capability_type' => ['author', 'authors'], 'map_meta_cap' => true]); }
<?php /* @var $this GroupController */ /* @var $model Group */ $this->breadcrumbs = array('Groups' => array('index'), 'Manage'); $this->menu = array(array('label' => 'List Group', 'url' => array('index')), array('label' => 'Create Group', 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#group-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n"); ?> <h1>Manage Groups</h1> <p> You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done. </p> <?php echo CHtml::link('Advanced Search', '#', array('class' => 'search-button')); ?> <div class="search-form" style="display:none"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'group-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id' => ['name' => 'id', 'htmlOptions' => ['width' => 30]], 'name', 'faculty_id' => ['name' => 'faculty_id', 'value' => '$data->faculty->name', 'filter' => Faculty::all()], 'direction_id' => ['name' => 'direction_id', 'value' => '$data->direction->name', 'filter' => Direction::all()], array('class' => 'CButtonColumn'))));
<?php include "faculty.php"; $obj = new Faculty(); if (isset($_GET['fid'])) { $id = $_GET['fid']; $name = $_GET['fna']; $str = "update FACULTY set Faculty_Name='{$name}' where Faculty_Id='{$id}'"; //echo "id=$id name= $name"; $re = $obj->query($str); if (!$re) { //die('Updation Failed for the Faculty '.mysql_error()); } else { //echo "<br>"; // echo "<center><b><font size=4>Updation is Successful on $name</font></b></center>"; header('location:facultyView.php'); } } else { header('location:facultyView.php'); }
/** * @return \yii\db\ActiveQuery */ public function getFaculties() { return $this->hasMany(Faculty::className(), ['university_id' => 'id']); }
public function faculty_make_add($data) { $retData = Faculty::add($data); $__viewData = array(); $__viewData['Data']['TableHeader'] = Faculty::$HEADER; $__viewData['Data']['TableContent'] = MyDataParser::build_table_view(Faculty::get_list(), Faculty::$HEADER); $__viewData['Data']['IsRenderAfterPost'] = true; $__viewData['Data']['Error'] = $retData; $this->template->__yield__ = View::forge('department/faculty', $__viewData); }
<?php return array("fields" => array("doc_id" => array("label" => "Doc ID"), "doc_path" => array("label" => "File", "type" => "_document", "modelFile" => "doc_path_file"), "doc_url" => array("label" => "Preview", "type" => "_image"), "doc_name" => array("label" => "Doc Name"), "doc_description" => array("label" => "Doc Description", "type" => "_textarea"), "doc_author_name" => array("label" => "User upload"), "subject_dept" => array("label" => "Department", "type" => "_dropdown", "_list" => array("primary" => "dept_id", "displayAttr" => "dept_name", "src" => function () { $rows = Dept::model()->findAll(); return $rows; })), "subject_doc" => array("label" => "Subject", "type" => "_dropdown", "_list" => array("primary" => "subject_id", "displayAttr" => "subject_name", "src" => function () { $rows = Subject::model()->findAll(); return $rows; })), "subject_faculty" => array("label" => "Faculty", "type" => "_dropdown", "_list" => array("primary" => "faculty_id", "displayAttr" => "faculty_name", "src" => function () { $rows = Faculty::model()->findAll(); return $rows; })), "subject_type" => array("label" => "Subject Type", "type" => "_dropdown", "_list" => array("primary" => "id", "displayAttr" => "subject_type_name", "src" => function () { $rows = SubjectType::model()->findAll(); return $rows; })), "doc_dept_name" => array("label" => "Department", "src" => "dept.dept_name")), "columns" => array("doc_id", "doc_url", "doc_name", "doc_description", "doc_author_name", "subject_faculty", "doc_dept_name", "doc_path"), "actions" => array("_view" => true, "_edit" => array("doc_name", "doc_description", "doc_author_name", "subject_dept", "subject_faculty", "subject_type"), "_delete" => true, "_new" => array("type" => "popup", "attr" => array("doc_name", "doc_description", "doc_path", "subject_doc"), "extend" => array("doc_author" => Util::param("ADMIN_ID"), "doc_author_name" => "Admin")), "_search" => array("doc_id", "doc_name"), "_search_advanced" => array("doc_author_name", "subject_dept", "subject_faculty", "doc_name"), "_customButtons" => array()), "default" => array("orderBy" => "doc_id", "orderType" => "desc", "page" => 1, "per_page" => 10, "search" => "", "search_advanced" => ""), "join" => array("dept" => array("table" => "select dept_id, dept_name from tbl_dept", "type" => "left join", "selected_properties" => array("dept_name" => "doc_dept_name"), "on" => array("dept_id" => "t.subject_dept"))), "tableAlias" => "document", "title" => "Document Manager", "condition" => false, "limit_values" => array(10, 20, 30, 40), "model" => "Doc", "primary" => "doc_id", "itemLabel" => "Document", "additionalFiles" => array(), "insertScenario" => "fromAdmin", "updateScenario" => "fromAdmin", "formUpload" => TRUE);
namespace Ventus\Faculty; //============================================================================================ // Session, config //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('faculty', true); if (!isset($SESSION->email)) { header('location: index.php?next=' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']); die; } //============================================================================================ // Load the Model and L10N //============================================================================================ $model = new Faculty(); $examFiles = new \Ventus\Exams\ExamFiles($dbo); if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) { $l10n->setLanguage($SESSION->corr_lang); \Locale::setDefault($SESSION->corr_lang); } $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { if (isset($_POST['rid'])) { $request_details = $model->fetchExamRequestDetails($_POST['rid']); //Fetch all the students in this course and then remove the ones that have opted out $students_in_course = \Ventus\Utilities\Functions::fetchDataStudents(array("Exam"), $request_details[0]['course_code'], $request_details[0]['course_section'], $request_details[0]['session']); $request_details[0]['session_code'] = $request_details[0]['session'];
public function getViewVoters() { $faculties = Faculty::where('Active', '=', TRUE)->get(); View::share('faculties', $faculties); $residences = Residence::where('Active', '=', TRUE)->get(); View::share('residences', $residences); $voters = Student::where('Active', '=', TRUE)->get(); View::share('voters', $voters); return View::make('admin.admin-view-voters'); }
<?php include "faculty.php"; $obj = new Faculty(); if (isset($_REQUEST['st'])) { $fa = $_REQUEST['st']; $str = "select * from FACULTY where Faculty_Name like '%{$fa}%' OR Faculty_Id='{$fa}'"; $result = $obj->query($str); $row = $obj->fetch(); echo "Suggestion: "; echo "<select>"; while ($row) { echo "<option value=''>" . $row['Faculty_Name'] . "</option>"; $row = $obj->fetch(); } echo "</select>"; }
<?php require_once 'user.php'; $u = new Faculty(201002001); $t = $u->get_notification(10);
<?php include "faculty.php"; $obj = new Faculty(); if (isset($_GET['fid'])) { $id = $_GET['fid']; $name = $_GET['fna']; if (!$obj->addFacultyDetail($id, $name)) { echo "Error in Adding faculty " . mysql_error(); } else { echo "Successful in adding {$name}"; //header('location:faculView.php'); } }
<div class = "col-sm-8"> <div class = "panel panel-default"> <div class = "panel-heading"> <strong>Choose a Load</strong> </div> <div class = "panel-body"> <form action = "processes/pr_choose_subject.php" method = "post"> <?php $memtype = $_SESSION['memtype']; if ($memtype == 1) { # student } else { if ($memtype == 2) { # faculty require_once 'faculty/classes/class_faculty.php'; $faculty = new Faculty(); $faculty->loadFacultyLoads($_SESSION['userID']); } else { if ($memtype == 3) { # admin } } } ?> <input type = "hidden" name = "continue" value = "<?php echo $_SESSION['memtype']; ?> "> <button class = "btn btn-default">Continue</button> </form> </div>
</div> <div class="row"> <?php echo $form->label($model, 'name'); ?> <?php echo $form->textField($model, 'name', array('size' => 50, 'maxlength' => 50)); ?> </div> <div class="row"> <?php echo $form->label($model, 'faculty_id'); ?> <?php echo $form->dropDownList($model, 'faculty_id', Faculty::all()); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton('Search'); ?> </div> <?php $this->endWidget(); ?> </div><!-- search-form -->
public function listCategoryFather() { $category_father = Faculty::model()->findAll(); return $category_father; }
<?php $form = $this->beginWidget('CActiveForm', array('htmlOptions' => array('enctype' => 'multipart/form-data'), 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'successCssClass' => '', 'errorCssClass' => 'error'))); ?> <table class='table table-hover'> <?php echo Yii::app()->format->formatInputField($form, 'textField', $model, 'title', 'icon-tag', array('maxlength' => 128)); ?> <?php echo Yii::app()->format->formatInputField($form, 'textArea', $model, 'description', 'icon-zoom-in', array('rows' => 6, 'cols' => 50)); ?> <?php echo Yii::app()->format->formatInputField($form, 'dropDownList', $model, 'faculty_id', 'icon-briefcase', array('prompt' => 'Pilih fakultas', 'ajax' => array('type' => 'POST', 'url' => array('note/updateCourses'), 'update' => '#courses', 'data' => array('faculty_id' => 'js:this.value')), 'options' => array('1' => array('selected' => 'selected'))), array('data' => CHtml::listData(Faculty::model()->findAll(), 'id', 'name'))); ?> <?php echo Yii::app()->format->formatInputField($form, 'dropDownList', $model, 'course_id', 'icon-book', array('prompt' => 'Pilih mata kuliah'), array('data' => CHtml::listData(Course::model()->findAllByAttributes(array('faculty_id' => 1), array('order' => 'name ASC')), 'id', 'name'), 'beforeInput' => '<span id="courses">', 'afterInput' => '</span>')); ?> <?php echo Yii::app()->format->formatInputField($form, 'fileField', $model, 'file', 'icon-file', array(), array('hint' => ' (maks ' . Yii::app()->format->size(Note::MAX_FILE_SIZE) . ', PDF/JPEG)')); ?> <tr> <td><label><em>atau ketikkan catatan Anda</em></label></td> <td> <?php Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/tiny_mce/tiny_mce.js');
/** * @return \yii\db\ActiveQuery */ public function getFaculty() { return $this->hasOne(Faculty::className(), ['id' => 'faculty_id']); }
namespace Ventus\Faculty; //============================================================================================ // Session, config //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('faculty', true); if (!isset($SESSION->email)) { header('location: index.php?next=' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']); die; } //============================================================================================ // Load the Model and L10N //============================================================================================ $noes = new NOE($dbo); $model = new Faculty(); if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) { $l10n->setLanguage($SESSION->corr_lang); \Locale::setDefault($SESSION->corr_lang); } $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { if (isset($_POST['rid'])) { $request_details = $model->fetchExamRequestDetails($_POST['rid']); $request_details[0]['session_long'] = \Ventus\Utilities\Functions::convertCodeToString($request_details[0]['session'], $l10n); //If the time this page is being loaded is less than 2 business days before the exam then the details cannot be edited $request_editable = false; if (time() < \Ventus\Utilities\Functions::findNextBusinessDay(strtotime(date('Y-m-d ', strtotime($request_details[0]['exam_date'])) . FACULTY_EXAM_MODIFICATIONS_BLOCK_AFTER_TIME), -1 * FACULTY_BUSINESS_DAYS_BEFORE_EXAM_BLOCK_CHANGES_NOE_DETAILS)) {