function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $requestid = new requests();
        $schools = $requestid->school();
        foreach ($schools as $school) {
            $value = $school->fullname;
            $key = $school->id;
        }
        $programs = $requestid->program($key);
        foreach ($programs as $pro) {
            $pro_val = $pro->fullname;
            $pro_key = $pro->id;
        }
        $semester = $requestid->previoussemsofuser($key, $pro_key);
        $cur_semester = $requestid->current_sem($key, $pro_key);
        $list = array();
        $list[''] = get_string("select", "local_request");
        foreach ($semester as $ses) {
            $key1 = $ses->id;
            $list[$key1] = $ses->fullname;
        }
        foreach ($cur_semester as $cus_ses) {
            global $sesid;
            $sesid = $cus_ses->id;
        }
        unset($list[$sesid]);
        $mform->addElement('select', 'semester_name', get_string('semester', 'local_semesters'), $list);
        $mform->addRule('semester_name', get_string('missingsemester', 'local_semesters'), 'required', null, 'server');

        $mform->addElement('editor', 'reason', get_string("reason_id", "local_request"));
        $mform->addRule('reason', get_string('error_request_id', 'local_request'), 'required', null, 'client');
        $this->add_action_buttons(true, get_string('submitbutton', 'local_request'));
    }
 public function add()
 {
     if (isset($_POST['groupname'])) {
         $requests = new requests($this->getDB());
         $new_request['group'] = $_POST['groupname'];
         $new_request['repo'] = $_POST['reponame'];
         $new_request['user'] = $_POST['username'];
         $requests->insert($new_request);
     }
     //display("add controller");
     /**/
 }
Exemple #3
0
 function definition_after_data() {
     global $DB, $CFG, $USER;
     $request = new requests();
     $mform = $this->_form;
     $program = $request->student_enrolled_program($USER->id);
     if (count($program) > 2) {
         $pid = $mform->getElementValue('programid');
         if (isset($pid) && !empty($pid) && $pid[0] > 0) {
             $sem = $request->student_enrolled_sem($pid[0]);
             $one = $mform->createElement('select', 'semesterid', get_string('semester', 'local_request'), $sem);
             $mform->insertElementBefore($one, 'beforesem');
             $mform->addRule('semesterid', get_string('required'), 'required', null, 'client');
         }
     }
 }
Exemple #4
0
    function definition_after_data() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $request = new requests();
        $countvalue = $mform->getElementValue('count');
        $school = $mform->getElementValue('schoolid');
        if ($countvalue > 1) {
            $semester = $request->currentsemester($school[0]);
            $mysemester = $mform->createElement('static', 'semester_name', get_string('semester', 'local_semesters'), $semester->fullname);
            $mform->createElement('hidden', 'semesterid', $semester->id);
            $mform->setType('semesterid', PARAM_INT);
            $mform->insertElementBefore($mysemester, 'addsemester');
        }
        $course = array();
        $semester = $mform->getElementValue('semesterid');
        $course = $request->get_enrolledcourses($semester, $school);

        $mycourse = $mform->createElement('select', 'courseid', get_string('course'), $course);
        $mform->setType('courseid', PARAM_INT);
        $mform->insertElementBefore($mycourse, 'addcourse');
        $mform->addHelpButton('courseid', 'courseid', 'local_request');
        $mform->addRule('courseid', get_string('required'), 'required', null, 'client');
        $size = 'style="width:50px !important;"';
        $mygrade = array();
        $mygrade[] = &$mform->createElement('text', 'grades', '', $size);
        $mygrade[] = &$mform->createElement('static', 'outof', '', '100');
        $grade = $mform->createElement('group', 'mygrade', get_string('grades'), $mygrade, ' / ', false);
        $mform->insertElementBefore($grade, 'addcourse');
        $mform->addHelpButton('mygrade', 'mygrade', 'local_request');
        $mform->addRule('mygrade', get_string('required'), 'required', null, 'client');
    }
global $DB, $USER, $val;
require_once("$CFG->libdir/pdflib.php");
require_once ("../../local/request/lib/lib.php");
require_once('../../message/lib.php');
$id = optional_param('id', $USER->id, PARAM_INT);

$sch = optional_param('school', 0, PARAM_INT);
$activ = optional_param('activitytype', 0, PARAM_INT);
$sem = optional_param('semester', 0, PARAM_INT);
$eve = optional_param('eventlev', 0, PARAM_RAW);
$systemcontext = context_system::instance();
$doc = new TCPDF(null, 'cm', 'A4', true, 'UTF-8', false);
$doc->setPrintHeader(FALSE);
$doc->setPrintFooter(FALSE);
$doc->Addpage($orientation = 'P', $format = 'A4', $keepmargins = true, $tocpage = true);
$re = new requests();
$schoolid = $DB->get_field('local_school', 'id', array('fullname' => $_GET['school']));
$semester = $DB->get_field('local_semester', 'id', array('fullname' => $_GET['semester']));
$activitytype = $DB->get_field('local_event_types', 'id', array('eventtypename' => $_GET['activitytype']));
$programid = $DB->get_field('local_program', 'id', array('fullname' => $_GET['program']));
$strdate = strtotime($_GET['startdate']);
"<br>";
$enddate = strtotime($_GET['enddate']);
$acivitylev = $_GET['eventlev'];
if ($acivitylev) {
    if ($acivitylev == 'Global') {
        $actlev = 1;
    }
    if ($acivitylev == 'School') {
        $actlev = 2;
    }
    function definition_after_data() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $id = $this->_customdata['id'];
        $requestpro = new requests();
        $school = $mform->getElementValue('school_name');
        $countvalue = $mform->getElementValue('count');
        $fields = $mform->getElementValue('field_select');
        $fid = $school[0];
        if ($countvalue == 1) {
            $pro_count = $mform->getElementValue('count_pros');
            if ($pro_count > 1) {
                // single school and more than one program assigned to a user
                $program1 = $mform->getElementValue('program_name1');
                $schoolid = $mform->getElementValue('schoolid');

                echo $pro_index = $program1[0];
                if ($pro_index > 0 && $pro_count > 1) {
                    $semesteres = $requestpro->semester($schoolid, $pro_index);
                    $serviceid = $requestpro->service($schoolid, $pro_index);

                    foreach ($semesteres as $s) {
                        $value2 = $s->fullname;
                    }
                    $ser_id = $mform->createElement('static', 'serviceid', get_string('student_id', 'local_request'), $serviceid->serviceid);
                    $mform->insertElementBefore($ser_id, 'name');
                    $sem_name = $mform->createElement('static', 'semester_name', get_string('semester', 'local_semesters'), $value2);
                    $mform->insertElementBefore($sem_name, 'addschool');
                }
            }
        }
        // more than one school assiged to a user
        if ($school[0] > 0 && isset($school) && $countvalue > 1) {

            $users = $requestpro->users($fid);
            $programses = $requestpro->program($fid);
            $mypro = array();
            $mypro[''] = '--Select--';
            foreach ($programses as $p) {
                $mypro[$p->id] = $p->fullname;
            }
            $service = $requestpro->service($fid, $p->id);
            $username = $mform->createElement('static', 'name', get_string('name', 'local_request'), $users->fullname);
            $mform->insertElementBefore($username, 'addschool');
            $emailid = $mform->createElement('static', 'email_id', get_string('email_id', 'local_request'), $users->email);
            $mform->insertElementBefore($emailid, 'addschool');

            $ser_id = $mform->createElement('static', 'serviceid', get_string('student_id', 'local_request'), $service->serviceid);
            $mform->insertElementBefore($ser_id, 'addschool');
            if (count($mypro) == 2) {
                // more than school and one program to user
                $pro_name = $mform->createElement('static', 'program_name', get_string('program', 'local_programs'), $mypro[$p->id]);
                $mform->insertElementBefore($pro_name, 'addschool');
                $pro_id = $mform->createElement('hidden', 'programid', $p->id);
                $mform->insertElementBefore($pro_id, 'addschool');
                $semesteres = $requestpro->semester($fid, $p->id);
                foreach ($semesteres as $s) {
                    $mysemvalue = $s->fullname;
                }
                $sems_name = $mform->createElement('static', 'semester_name', get_string('semester', 'local_semesters'), $mysemvalue);
                $mform->insertElementBefore($sems_name, 'addschool');
                $sem_id = $mform->createElement('hidden', 'semesterid', $s->id);
                $mform->insertElementBefore($sem_id, 'addschool');
            } else {
                // more than one program and school assined to user
                $pro_name = $mform->createElement('select', 'program_name', get_string('program', 'local_programs'), $mypro);
                $mform->insertElementBefore($pro_name, 'addschool');
            }
            $formatvalue3 = $mform->getElementValue('program_name');
            if ($formatvalue3[0] > 0) {
                $semesteres = $requestpro->semester($fid, $formatvalue3[0]);
                foreach ($semesteres as $s) {
                    $mysemvalue = $s->fullname;
                }
                $se_name = $mform->createElement('static', 'semester_name', get_string('semester', 'local_semesters'), $mysemvalue);
                $mform->insertElementBefore($se_name, 'addschool');
            }
        }
        if (isset($fields[0]) && $fields[0] != null) {
            if ($fields[0] == 0) {
                $result = $DB->get_record('local_request_profile_change', array('reg_approval' => 0, 'subjectcode' => 1, 'studentid' => $USER->id));
            }if ($fields[0] == 1) {
                $result = $DB->get_record('local_request_profile_change', array('reg_approval' => 0, 'subjectcode' => 2, 'studentid' => $USER->id));
            }
            if (!empty($result)) {
                if ($fields[0] == 0) {
                    $errormsg = $mform->createElement('html', '<div class="alert alert-danger">' . get_string('noteforname', 'local_request') . '</div>');
                    $mform->insertElementBefore($errormsg, 'fields');
                }if ($fields[0] == 1) {
                    $errormsg = $mform->createElement('html', '<div class="alert alert-danger">' . get_string('noteforemail', 'local_request') . '</div>');
                    $mform->insertElementBefore($errormsg, 'fields');
                }
            } else {
                $editheader = $mform->createElement('header', 'settingsheader', get_string('edit_settings', 'local_request'));
                $mform->insertElementBefore($editheader, 'fields');
                $users = $requestpro->current_user();
                $fullname = $users->firstname . " " . $users->lastname;
                if ($fields[0] == 0 && $fields[0] != null) {
                    $username = $mform->createElement('static', 'fullname', get_string('present_data', 'local_request'), $fullname);
                    $mform->insertElementBefore($username, 'fields');
                }
                if ($fields[0] == 1 && $fields[0] != null) {
                    $email_id = $mform->createElement('static', 'email_id', get_string('present_data', 'local_request'), $users->email);
                    $mform->insertElementBefore($email_id, 'fields');
                }
                $changeto = $mform->createElement('text', 'changeto', get_string("request_to_chage", "local_request"));
                $mform->insertElementBefore($changeto, 'fields');
                $mform->addRule('changeto', get_string('error_change_to', 'local_request'), 'required', null, 'client');

                $reason = $mform->createElement('editor', 'reason', get_string("reason_id", "local_request"));
                $mform->setType('reason', PARAM_RAW);
                $mform->insertElementBefore($reason, 'fields');

                $mform->addRule('reason', get_string('error_request_id', 'local_request'), 'required', null, 'client');
            }
        }
    }
Exemple #7
0
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser()) {

    print_error('You dont have permissions');
}
$strheading = get_string('requisitions_transfer', 'local_request');
$PAGE->set_title($strheading);
$PAGE->set_heading($strheading);
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('view', 'local_request'));
$data = array();
global $USER;
$url = '../../local/request/requestid.php';
$requestid = new requests();
echo $OUTPUT->header();

echo $OUTPUT->heading(get_string('requisitions_transfer', 'local_request'));


/* link for requesting a for id card */
$currenttab = 'view';
$requestid->requesttransfertabview($currenttab);
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('tranferdes', 'local_request'));
}
echo "<br>";
$details = $DB->get_records('local_request_transfer', array('studentid' => $USER->id));
foreach ($details as $detail) {
    $list = array();
Exemple #8
0
require_once(dirname(__FILE__) . '/../../config.php');
require_once('../../local/request/lib/lib.php');
$var = optional_param('x', 0, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/approval/approval_profile.php');
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser()) {
    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('profileapprovals', 'local_approval');
$PAGE->navbar->add($strheading);
$PAGE->set_title($strheading);
$requestpro = new requests();
$data = array();
global $USER;
$url = '../../local/request/requestprofile.php';
if ($var) {
    redirect($url);
}
$data = array();
echo $OUTPUT->header();
$requests = $DB->get_records('local_request_profile_change', array('reg_approval' => '0'));
foreach ($requests as $request) {
    $list = array();
    if ($vals = $DB->get_records_sql("SELECT * FROM {local_school_permissions} where userid = '" . $USER->id . "' and schoolid='" . $request->schoolid . "'")) {
        $serviceid = $requestpro->service($request->schoolid, $request->studentid);
        $list[] = $serviceid->serviceid;
        $list[] = $DB->get_field('local_school', 'fullname', array('id' => $request->schoolid));
<?php

ini_set("memory_limit", "1024M");
require dirname(__FILE__) . '/../core/init.php';
/* Do NOT delete this comment */
/* 不要删除这段注释 */
$configs = array('name' => '糗事百科', 'log_show' => true, 'tasknum' => 5, 'domains' => array('qiushibaike.com', 'www.qiushibaike.com'), 'scan_urls' => array('http://www.qiushibaike.com/'), 'list_url_regexes' => array("http://www.qiushibaike.com/8hr/page/\\d+\\?s=\\d+"), 'content_url_regexes' => array("http://www.qiushibaike.com/article/\\d+"), 'max_try' => 5, 'export' => array('type' => 'db', 'table' => 'content'), 'fields' => array(array('name' => "article_title", 'selector' => "//*[@id='single-next-link']//div[contains(@class,'content')]/text()[1]", 'required' => true), array('name' => "article_author", 'selector' => "//div[contains(@class,'author')]//h2", 'required' => true), array('name' => "article_headimg", 'selector' => "//div[contains(@class,'author')]//a[1]", 'required' => true), array('name' => "article_content", 'selector' => "//*[@id='single-next-link']//div[contains(@class,'content')]", 'required' => true), array('name' => "article_publish_time", 'selector' => "//div[contains(@class,'author')]//h2", 'required' => true), array('name' => "url", 'selector' => "//div[contains(@class,'author')]//h2", 'required' => true)));
$spider = new phpspider($configs);
$spider->on_start = function ($phpspider) {
    //requests::add_header("Referer", "http://buluo.qq.com/p/index.html");
    requests::add_cookie("name", "yangzetao");
};
$spider->on_handle_img = function ($fieldname, $img) {
    $regex = '/src="(https?:\\/\\/.*?)"/i';
    preg_match($regex, $img, $rs);
    if (!$rs) {
        return $img;
    }
    $url = $rs[1];
    $img = $url;
    //$pathinfo = pathinfo($url);
    //$fileext = $pathinfo['extension'];
    //if (strtolower($fileext) == 'jpeg')
    //{
    //$fileext = 'jpg';
    //}
    //// 以纳秒为单位生成随机数
    //$filename = uniqid().".".$fileext;
    //// 在data目录下生成图片
    //$filepath = PATH_ROOT."/images/{$filename}";
    //// 用系统自带的下载器wget下载
Exemple #10
0
function render_cocustommenu() {
    global $CFG, $USER, $DB, $OUTPUT, $PAGE;
    $systemcontext = context_system::instance();
    $usercontext =context_user::instance($USER->id);
    $content = '<ul class="nav">';
    if (has_capability('local/cobaltsettings:manage', $systemcontext)) {
        $content .="<li class='dropdown'>
                                  <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Organization Settings<b class='caret'></b></a>
                                  <ul class='dropdown-menu'>
                                   <li><a href=$CFG->wwwroot/local/cobaltsettings/category_level.php>CobaltLMS Entity Settings</a></li>
                                   <li><a href=$CFG->wwwroot/local/cobaltsettings/school_settings.php>Organization Settings</a></li>
                                   <li><a href=$CFG->wwwroot/local/cobaltsettings/gpa_settings.php>GPA/CGPA Settings</a></li>
                                   <li><a href=$CFG->wwwroot/local/prefix>Prefix and Suffix</a></li>
                                   </ul></li>";
    }
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $content .="<li class='dropdown'>
                                  <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Hierarchy<b class='caret'></b></a>
                                  <ul class='dropdown-menu'>";
    }
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/collegestructure>Organizations</a></li>";
    }
    if (has_capability('local/departments:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/departments>Course Libraries</a></li>";
    }
    if (has_capability('local/programs:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/programs>Programs</a></li>";
    }
    if (has_capability('local/semesters:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/semesters>Course Offerings</a></li>";
    }
    if (has_capability('local/curriculum:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/curriculum>Curriculums</a></li>";
    }
    if (has_capability('local/modules:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/modules>Modules</a></li>";
    }
    if (has_capability('local/cobaltcourses:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/cobaltcourses>Courses</a></li>";
    }
    if (has_capability('local/classes:manage', $systemcontext)) {
        $content .="<li><a href=$CFG->wwwroot/local/classes>Classes Management</a></li>";
    }
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $content .="</ul></li>";
    }
    if (has_capability('local/gradeletter:manage', $systemcontext)) {
        $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Assesments<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
        if (has_capability('local/gradeletter:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/gradeletter>Grade letters</a></li>";
        }
        if (has_capability('local/examtype:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/examtype>Assesment type</a></li>";
        }
        if (has_capability('local/lecturetype:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/lecturetype>Lecture type</a></li>";
        }
        if (has_capability('local/gradesubmission:manage', $systemcontext) && has_capability('local/lecturetype:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/gradesubmission>Grade Submission</a></li>";
        }
        if (has_capability('local/scheduleexam:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/scheduleexam>Assesments</a></li>";
        }
        $content .="</ul></li>";
        $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/registrar/index.html  target='_blank'>Help Manual</a></li>";
    }
    /*   if(has_capability('local/classroomresources:manage', $systemcontext)){
      $content .="<li class='dropdown'>
      <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Resourse Management<b class='caret'></b></a>
      <ul class='dropdown-menu'>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/index.php>Manage Buildings</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/viewfloor.php>Manage Floors</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/viewclassroom.php>Manage Classrooms</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/viewresource.php>Manage Resources</a></li>";
      $content .="<li><a href=$CFG->wwwroot/local/classroomresources/view.php>Assign Resources</a></li>";
      $content .="</ul></li>";
      } */

    //   $content .='</ul>';
    //for instructor starts-------------------------------------------------------
    if (has_capability('local/classes:submitgrades', $systemcontext)) {
        if (!is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/academiccalendar>Events Calendar</a></li>";

            $content .="<li><a href=$CFG->wwwroot/local/classroomresources/timetable.php>Class Schedule</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/scheduleexam>Assesments Schedule</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/instructor/index.html target='_blank'>Help Manual</a></li>";
        }
    }

    //for instructor ends-------------------------------------------------------
    //For students starts-----------------------------------------------------
    if (isloggedin()) {
        $context = context_user::instance($USER->id);
        if (has_capability('local/classes:enrollclass', $context) && !is_siteadmin()) {
            //----------------------starts of my academics------------------------------
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>My Learning<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/mycur.php>Curriculum</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/myclasses.php>Current Classes</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/scheduleexam>Scheduled Assesments</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/myacademics/transcript.php>Transcript</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/academiccalendar>Events Calender</a></li>";
            $content .="</ul></li>";
            //--------------------------------end of my academics--------------------------------------------------------------------------------
            //--------------------------------course registration--------------------------------------------------------------------------------
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>Course Registration<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/index.php>Register to Course/Class</a></li>";
            $content .="</ul></li>";
            //--------------------end of course registration----------------------------------------------------------------------------------------------
            //--------------------Requests links----------------------------------------------------------------------------------------------------------
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown'>My Requests<b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_id.php>ID Card</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_profile.php>Profile Change</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_transcript.php>Transcript</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/course_exem.php>Course Exemption</a></li>";
            $content .="</ul></li>";
            //-----------------------------end of requests links-------------------------------------------------------------------------------------------
            $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/student/index.html target='_blank'>Help Manual</a></li>";
        }
    }
    // for mentor starts-------------------------------------------
    if (has_capability('local/classes:approvemystudentclasses', $systemcontext) && !is_siteadmin()) {
        $content .="<li><a href=$CFG->wwwroot/local/mentor>My Students</a></li>";
        $content .="<li><a href=$CFG->wwwroot/local/helpmanuals/mentor/index.html target='_blank'>Help Manual</a></li>";
    }
    // mentor ends
    if (isloggedin() & !isguestuser()) {

        $msgnotification = message_count_unread_messages($USER);
        $heirarchy = new hierarchy();
        $request = new requests();
        $applicationnotice = $heirarchy->count_admissions_from_applicants($USER->id);
        $requestnotice = $request->all_student_requests_count($USER->id);
        $courserequestnotice = $heirarchy->count_course_requests_from_students($USER->id);
        $transcriptnotice = $heirarchy->count_transcript_req_from_student($USER->id);
        $courseexemptionnotice = $heirarchy->count_coureexe_req_from_student($USER->id);
        $profilechangenotice = $heirarchy->count_profilechange_req_from_student($USER->id);
        $idcardnotice = $heirarchy->count_idcard_req_from_student($USER->id);
        $newappnotice = $heirarchy->count_new_admission_req_from_student($USER->id);
        $transferappnotice = $heirarchy->count_transfer_admission_req_from_student($USER->id);
        $totalrequest = $courserequestnotice + $requestnotice;

        $content .="<li><a href=$CFG->wwwroot/message/ title='Messages' id='messages'>
         <sup  id='msgnotice'>$msgnotification</sup></a></li>";
        $context = context_user::instance($USER->id);
        if (has_capability('local/classes:enrollclass', $context) && !is_siteadmin()) {
            $allapprovals = $request->all_approved_requests($USER->id);
            $transcriptapprovals = $heirarchy->count_trasncripts_approve_from_registrar($USER->id);
            $courseexemptionapproval = $heirarchy->count_courseexe_approve_from_registrar($USER->id);
            $idcardapproval = $heirarchy->count_idcard_approve_from_registrar($USER->id);
            $profilechangeapproval = $heirarchy->count_profilechange_approve_from_registrar($USER->id);
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle open'  data-toggle='dropdown' id='allrequests' title='Request Approvals'>
                            <sup id='arequests'>$allapprovals</sup></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_transcript.php>Transcripts($transcriptapprovals)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/course_exem.php>Coures Exemptions($courseexemptionapproval)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_id.php>ID Card($idcardapproval)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/request_profile.php>Profile Change($profilechangeapproval)</a></li>";
            $content .="</ul></li>";
        }
        if (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin($USER->id)) {
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown' id='apprequests' title='Applicant Requests'>
                            <sup id='requests'>$applicationnotice</sup></a>
                            <ul class='dropdown-menu'>";
            $content .="<li><a href=$CFG->wwwroot/local/admission/viewapplicant.php>New Application($newappnotice)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/admission/transferapplicant.php>Transfer Application($transferappnotice)</a></li>";
            $content .="</ul></li>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown' id='allrequests' title='Requests'>
                            
                            <sup id='arequests'>$totalrequest</sup></a>
                            <ul class='dropdown-menu'>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/registrar.php?current=pending>Approve Course (<b class='counts'>$courserequestnotice </b>)</a></li>";
        }
        if (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin($USER->id)) {
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_transcript.php>Approve Transcripts (<b class='counts'>$transcriptnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approveexem.php>Approve Coures Exemptions (<b class='counts'>$courseexemptionnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_id.php>Approve ID Card (<b class='counts'>$idcardnotice</b>)</a></li>";
            $content .="<li><a href=$CFG->wwwroot/local/request/approval_profile.php>Approve Profile Change (<b class='counts'>$profilechangenotice</b>)</a></li>";
        }
        if ((has_capability('local/collegestructure:manage', $systemcontext) || has_capability('local/classes:approvemystudentclasses', $systemcontext)) && !is_siteadmin($USER->id)) {
            $content .="</ul></li>";
        }
        if (has_capability('local/academiccalendar:manage', $systemcontext)) {
            $content .="<li class='dropdown'>
                            <a href='#' class='dropdown-toggle'  data-toggle='dropdown' id='quicklinks'><img src= $CFG->wwwroot/theme/colms/pix/quicklinks.png class='dropdown-toggle'  data-toggle='dropdown'/><b class='caret'></b></a>
                            <ul class='dropdown-menu'>";
        }
        if (has_capability('local/academiccalendar:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/academiccalendar>Events Calendar</a></li>";
        }
        if (has_capability('local/admission:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/admission/viewapplicant.php>Online Registrations</a></li>";
        }
        if (has_capability('local/courseregistration:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/courseregistration/registrar.php?current=pending>Course Enrollments</a></li>";
        }
        if (has_capability('local/courseregistration:manage', $systemcontext)) {
            $content .="<li><a href=$CFG->wwwroot/local/evaluations/index.php>Evaluations</a></li>";
        }
        if (has_capability('local/academiccalendar:manage', $systemcontext)) {
            $content .="</ul></li>";
        }
    }

    $content .="</ul>";

    //For students ends------------------------------------------------------
    return $content;
}
Exemple #11
0
ini_set("memory_limit", "1024M");
require dirname(__FILE__) . '/../core/init.php';
/* Do NOT delete this comment */
/* 不要删除这段注释 */
$configs = array('name' => '天行云', 'log_show' => true, 'tasknum' => 1, 'max_try' => 5, 'domains' => array('www.xyb2b.com'), 'scan_urls' => array('http://www.xyb2b.com/Products/Index'), 'list_url_regexes' => array("http://www.xyb2b.com/Products/Index/start/\\d+"), 'content_url_regexes' => array("http://www.xyb2b.com/Home/Products/detail/gid/\\d+"), 'fields' => array(array('name' => "txy_price", 'selector' => '//*[@id="goodsForm"]/div[6]/div[1]/div[2]/div[2]/div/div/ul/li/h2/text()', 'required' => true), array('name' => "article_content", 'selector' => "//h1[@id='detailName']", 'required' => true), array('name' => "article_num", 'selector' => '//*[@id="showNum"]', 'required' => true), array('name' => "article_publish_time", 'selector' => "//div[contains(@class,'author')]//h2", 'required' => true), array('name' => "url", 'selector' => "//div[contains(@class,'author')]//h2", 'required' => true)));
$spider = new phpspider($configs);
$spider->on_start = function ($phpspider) {
    // 登录请求url
    $login_url = "http://www.xyb2b.com/Home/User/doLogin";
    // 提交的参数
    $options = array("m_name" => "public", "m_password" => "123456", "savelogin" => "0", "requsetUrl" => "http://www.xyb2b.com/Products/Index/start/1");
    // 发送登录请求
    requests::post($login_url, $options);
    //$phpspider->request_url($login_url, $options);
    // 登录成功后本框架会把Cookie保存到www.waduanzi.com域名下,我们可以看看是否是已经收集到Cookie了
    $cookies = requests::get_cookies("www.xyb2b.com");
    // print_r($cookies);exit;  // 可以看到已经输出Cookie数组结构
    // 框架自动收集Cookie,访问这个域名下的URL会自动带上
    // 接下来我们来访问一个需要登录后才能看到的页面
    // $url = "http://www.xyb2b.com/Ucenter/Cart/pageList";
    // $html = $phpspider->request_url($url);
    // echo $html;     // 可以看到登录后的页面,非常棒👍
};
$spider->on_scan_page = function ($page, $content, $phpspider) {
    preg_match('#<a href="(.*)" class="change">尾页</a>#', $content, $out);
    preg_match('(\\d+)', $out[1], $out_2);
    for ($i = 0; $i <= $out_2[0]; $i++) {
        $url = "http://www.xyb2b.com/Products/Index/start/{$i}";
        $options = array('url_type' => $url, 'method' => 'get');
        $phpspider->add_url($url, $options);
    }
Exemple #12
0
<?php

require_once(dirname(__FILE__) . '/../../config.php');
global $CFG, $DB, $PAGE, $USER;
require_once($CFG->dirroot . '/local/request/lib/lib.php');
require_once($CFG->dirroot . '/local/request/transcript_form.php');
$totalgradepoints = optional_param('totalgradepoints', 0, PARAM_INT);
$totalcredits = optional_param('totalcredits', 0, PARAM_INT);
$systemcontext = context_system::instance();
$request = new requests();
$PAGE->set_url('/local/request/transcript.php');
$PAGE->set_pagelayout('admin');
$conf = new object();
require_login();
$PAGE->set_context($systemcontext);
$PAGE->set_heading(get_string('mytranscripts', 'local_request'));
$PAGE->navbar->add(get_string('mytranscripts', 'local_request'), new moodle_url('/local/request/transcript.php'));
$PAGE->navbar->add(get_string('viewtranscript', 'local_request'));
$mform = new transcriptform();
$data = $mform->get_data();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('viewtranscript', 'local_request'));
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('transcriptdesc', 'local_request'));
}

$mform->display();
$returnurl = new moodle_url('/local/myacademics/index.php');
if ($mform->is_cancelled()) {
    redirect($returnurl);
}
Exemple #13
0
require_login();
$context = context_user::instance($USER->id);
if (!has_capability('local/clclasses:enrollclass', $context) || is_siteadmin()) {
    print_error('You dont have permissions');
}
if (!isloggedin() || isguestuser()) {

    print_error('You dont have permissions');
}
$strheading = get_string('requestcourseexem', 'local_request');
$PAGE->set_heading($strheading);
$PAGE->navbar->add($strheading);
$PAGE->set_title($strheading);
$data = array();

$requestid = new requests();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('requisitionsforexem', 'local_request'));

if ($student = $DB->get_records('local_request_courseexem', array('studentid' => $USER->id))) {
    foreach ($student as $stu) {
        $list = array();
        $list[] = $DB->get_field('local_semester', 'fullname', array('id' => $stu->semesterid));
        $list[] = $DB->get_field('local_cobaltcourses', 'fullname', array('id' => $stu->courseid));
        $list[] = date("Y-m-d", $stu->requestedon);
        if ($stu->registrarapproval == 1) {
            $list[] = get_string('approvedc', 'local_request');
        } elseif ($stu->registrarapproval == 2) {
            $list[] = get_string('rejectedc', 'local_request');
        } else {
            $list[] = get_string('pending', 'local_request');
Exemple #14
0
require_login();
if (!isloggedin() || isguestuser()) {
    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('requesttranscript', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('newrequest', 'local_request'));
$PAGE->set_title($strheading);

$mform = new requesttranscript_form();
$hierarchy = new hierarchy();
$nexturl = $CFG->wwwroot . '/local/request/request_transcript.php';
//Form processing and displaying is done here
$x = optional_param('schoolid', 0, PARAM_INT);
$requestid = new requests();
global $USER;

if ($mform->is_cancelled()) {
    /* if click on cancel it redirects us to request_id.php file */
    redirect($nexturl);
} else if ($fromform = $mform->get_data()) {
    /* presence of data */
    $check = $DB->get_record_sql("SELECT * FROM {local_request_transcript} WHERE studentid = {$USER->id} AND req_semester = {$fromform->semester_name}");
    $schools = $requestid->school();
    foreach ($schools as $school) {
        $value = $school->fullname;
        $key = $school->id;
    }
    $programs = $requestid->program($key);
    foreach ($programs as $pro) {
Exemple #15
0
}
require_login();
$name = $DB->get_record('user', array('id' => $id));
$local_users = $DB->get_record('local_users', array('userid' => $id));

$PAGE->set_heading($SITE->fullname);
$strheading = get_string('viewprofile', 'local_users');

if ($id == $USER->id) {
    $PAGE->navbar->add(get_string('myprofile', 'local_users'));
} else {
    $PAGE->navbar->add(get_string('browseusers', 'local_users'));
}
$PAGE->navbar->add($strheading);
$PAGE->set_title($strheading);
$requests = new requests();
$userid = $id ? $id : $USER->id;       // Owner of the page
if ((!$user = $DB->get_record('user', array('id' => $userid))) || ($user->deleted)) {

    echo $OUTPUT->header();
    if (!$user) {
        echo $OUTPUT->notification(get_string('invaliduser', 'error'));
    } else {
        echo $OUTPUT->notification(get_string('userdeleted'));
    }
    echo $OUTPUT->footer();
    die;
}

$currentuser = ($user->id == $id);
$context = $usercontext = context_user::instance($id, MUST_EXIST);
require_once('../../local/request/lib/lib.php');
$var = optional_param('x', 0, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/request/request_transcript.php');
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser() || is_siteadmin()) {
    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('requesttranscript', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('view', 'local_request'));
$PAGE->set_title($strheading);
$requestpro = new requests();
$data = array();
global $USER;
$url = '../../local/request/requesttranscript.php';
if ($var) {
    redirect($url);
}
$data = array();
echo $OUTPUT->header();

if ($requests = $DB->get_records('local_request_transcript', array('studentid' => $USER->id))) {
    foreach ($requests as $request) {
        $list = array();

        $list[] = $DB->get_field('local_semester', 'fullname', array('id' => $request->req_semester));
        $list[] = strtoupper(date("d-M-Y", $request->requested_date));
Exemple #17
0
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser()) {

    print_error('You dont have permissions');
}

$strheading = get_string('requisitions_id', 'local_request');
$PAGE->set_title($strheading);
$PAGE->set_heading($strheading);
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('view', 'local_request'));
$data = array();
global $USER;
$url = '../../local/request/requestid.php';
$requestid = new requests();
echo $OUTPUT->header();
if ($student = $DB->get_records('local_request_idcard', array('studentid' => $USER->id))) {
    foreach ($student as $students) {
        $list = array();
        $sql_pro = $DB->get_record_sql("select fullname from {local_program} where id=$students->programid");
        $list[] = $sql_pro->fullname;
        $list[] = $DB->get_field('local_semester', 'fullname', array('id' => $students->semesterid));
        $list[] = strtoupper(date("d-M-Y", $students->requested_date));
        if ($students->reg_approval == 1) {
            $list[] = get_string('approvedc', 'local_request');
        } elseif ($students->reg_approval == 2) {
            $list[] = get_string('rejectedc', 'local_request');
        } else {
            $list[] = get_string('pending', 'local_request');
        }
Exemple #18
0
$id = optional_param('id', -1, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/request/requestprofile.php');
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser()) {

    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('requisitions_profile', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('newrequest', 'local_request'));
$PAGE->set_title($strheading);
$requestpro = new requests();
$mform = new requestprofile_form();
$hierarchy = new hierarchy();
$nexturl = $CFG->wwwroot . '/local/request/request_profile.php';
$x = optional_param('schoolid', 0, PARAM_INT);
global $USER;
if ($mform->is_cancelled()) {
    /* if click on cancel it redirects us to request_profile.php file */
    redirect($nexturl);
} else if ($fromform = $mform->get_data()) {
    /* presence of data */
    if (isset($fromform->school_name)) {
        $schoolid = $fromform->school_name;
    }
    if (isset($fromform->schoolid)) {
        $schoolid = $fromform->schoolid;
Exemple #19
0
 /**
  * 下载网页,得到网页内容
  * 
  * @param mixed $url
  * @param mixed $options
  * @return void
  * @author seatle <*****@*****.**> 
  * @created time :2016-09-18 10:17
  */
 public function request_url($url, $options = array())
 {
     //$url = "http://www.qiushibaike.com/article/117568316";
     $link = array('url' => $url, 'url_type' => isset($options['url_type']) ? $options['url_type'] : '', 'method' => isset($options['method']) ? $options['method'] : 'get', 'headers' => isset($options['headers']) ? $options['headers'] : array(), 'params' => isset($options['params']) ? $options['params'] : array(), 'context_data' => isset($options['context_data']) ? $options['context_data'] : '', 'proxy' => isset($options['proxy']) ? $options['proxy'] : self::$configs['proxy'], 'try_num' => isset($options['try_num']) ? $options['try_num'] : 0, 'max_try' => isset($options['max_try']) ? $options['max_try'] : self::$configs['max_try']);
     // 设置了编码就不要让requests去判断了
     if (isset(self::$configs['input_encoding'])) {
         requests::$input_encoding = self::$configs['input_encoding'];
     }
     // 得到的编码如果不是utf-8的要转成utf-8,因为xpath只支持utf-8
     requests::$output_encoding = 'utf-8';
     requests::set_timeout(self::$configs['timeout']);
     requests::set_useragent(self::$configs['user_agent']);
     // 是否设置了代理
     if (!empty($link['proxy'])) {
         requests::set_proxies(array('http' => $link['proxy'], 'https' => $link['proxy']));
         // 自动切换IP
         requests::add_header('Proxy-Switch-Ip', 'yes');
     }
     // 如何设置了 HTTP Headers
     if (!empty($link['headers'])) {
         foreach ($link['headers'] as $k => $v) {
             requests::add_header($k, $v);
         }
     }
     // 如果设置了附加的数据,如json和xml,就直接发附加的数据,php端可以用 file_get_contents("php://input"); 获取
     $params = empty($link['context_data']) ? $link['params'] : $link['context_data'];
     $method = strtolower($link['method']);
     $html = requests::$method($url, $params);
     //var_dump($html);exit;
     $http_code = requests::$status_code;
     if ($this->on_status_code) {
         $return = call_user_func($this->on_status_code, $http_code, $url, $html, $this);
         if (isset($return)) {
             $html = $return;
         }
         if (!$html) {
             return false;
         }
     }
     if ($http_code != 200) {
         // 如果是301、302跳转,抓取跳转后的网页内容
         if ($http_code == 301 || $http_code == 302) {
             $info = requests::$info;
             $url = $info['redirect_url'];
             $html = $this->request_url($url, $options);
         } else {
             if ($http_code == 404) {
                 log::error(date("H:i:s") . " Failed to download {$url}\n");
                 //log::error(date("H:i:s")." Download page {$url} failed, Read timed out, will try again later\n");
                 log::error(date("H:i:s") . " HTTP CODE: {$http_code} Not Found\n");
             } elseif ($http_code == 407) {
                 // 扔到队列头部去,继续采集
                 $this->queue_rpush($link);
                 log::error(date("H:i:s") . " Failed to download {$url}\n");
                 log::error(date("H:i:s") . " Proxy server authentication failed, please check the proxy server settings\n");
             } elseif (in_array($http_code, array('0', '502', '503', '429'))) {
                 // 采集次数加一
                 $link['try_num']++;
                 // 抓取次数 小于 允许抓取失败次数
                 if ($link['try_num'] <= $link['max_try']) {
                     // 扔到队列头部去,继续采集
                     $this->queue_rpush($link);
                 }
                 log::error(date("H:i:s") . " Download page {$url} failed, Read timed out, will try again later, retry({$link['try_num']})\n");
                 log::error(date("H:i:s") . " HTTP CODE: {$http_code} service unavailable\n");
             } else {
                 log::error(date("H:i:s") . " Failed to download {$url}\n");
                 log::error(date("H:i:s") . " HTTP CODE: {$http_code}\n");
             }
             self::$collect_fail++;
             return false;
         }
     }
     self::$collect_succ++;
     return $html;
 }
    function definition_after_data() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $requestid = new requests();
        $id = $this->_customdata['id'];
        $school = $mform->getElementValue('school_name');
        $countvalue = $mform->getElementValue('count');
        $fid = $school[0];
        if ($countvalue == 1) {
            $pro_count = $mform->getElementValue('count_pros');
            if ($pro_count > 1) {
                // single school and more than one program assigned to a user
                $program1 = $mform->getElementValue('program_name1');
                $schoolid = $mform->getElementValue('schoolid');
                $pro_index = $program1[0];
                if ($pro_index > 0 && $pro_count > 1) {
                    $semesteres = $requestpro->semester($schoolid, $pro_index);
                    $semesteres = $requestid->semester($schoolid, $pro_index);
                    foreach ($semesteres as $s) {

                        $value2 = $s->fullname;
                    }
                    $ser_id = $mform->createElement('static', 'serviceid', get_string('student_id', 'local_request'), $serviceid->serviceid);
                    $mform->insertElementBefore($ser_id, 'program_name');
                    $sem_name = $mform->createElement('static', 'semester_name', get_string('semester_name', 'local_request'), $value2);
                    $mform->insertElementBefore($sem_name, 'addschool');
                }
            }
        }
        // more than one school assiged to a user
        if ($school[0] > 0 && isset($school) && $countvalue > 1) {
            $service = $requestid->service($fid);
            $users = $requestid->users($fid);
            $programses = $requestid->program($fid);
            $mypro = array();
            $mypro[''] = get_string('selectprogram', 'local_programs');
            foreach ($programses as $p) {
                $mypro[$p->id] = $p->fullname;
            }
            $ser_id = $mform->createElement('static', 'serviceid', get_string('student_id', 'local_request'), $service->serviceid);
            $mform->insertElementBefore($ser_id, 'addschool');
            $name = $mform->createElement('static', 'name', get_string('name', 'local_request'), $users->fullname);
            $mform->insertElementBefore($name, 'addschool');
            if (count($mypro) == 2) {
                // more than school and one program to user
                $pro_name = $mform->createElement('static', 'program_name', get_string('program_name', 'local_request'), $mypro[$p->id]);
                $mform->insertElementBefore($pro_name, 'addschool');
                $pro_id = $mform->createElement('hidden', 'programid', $p->id);
                $mform->insertElementBefore($pro_id, 'addschool');
                $semesteres = $requestid->semester($fid, $p->id);
                foreach ($semesteres as $s) {
                    $mysemvalue = $s->fullname;
                    $mysemid = $s->id;
                }
                $sems_name = $mform->createElement('static', 'semester_name', get_string('semester_name', 'local_request'), $mysemvalue);
                $mform->insertElementBefore($sems_name, 'addschool');
                $sem_id = $mform->createElement('hidden', 'semesterid', $mysemid);
                $mform->insertElementBefore($sem_id, 'addschool');
                $school_programs = $requestid->school_programs($fid);
                $programs = array();
                $programs[''] = get_string("select", "local_request");
                foreach ($school_programs as $sch_pro) {
                    $programs[$sch_pro->id] = $sch_pro->fullname;
                }
                $sch_pro = $mform->createElement('select', 'toprogramid', get_string('to_program_name', 'local_request'), $programs);
                $mform->insertElementBefore($sch_pro, 'addschool');
                $mform->addRule('toprogramid', get_string('error_request_transfer', 'local_request'), 'required', null, 'server');
            } else {
                // more than one program and school assined to user
                $pro_name = $mform->createElement('select', 'program_name', get_string('program_name', 'local_request'), $mypro);
                $mform->insertElementBefore($pro_name, 'addschool');
                $mform->addRule('program_name', get_string('programid', 'local_prefix'), 'required', null, 'client');
            }
            $formatvalue3 = $mform->getElementValue('program_name');
            if ($formatvalue3[0] > 0) {
                $semesteres = $requestid->semester($fid, $formatvalue3[0]);
                foreach ($semesteres as $s) {
                    $mysemvalue = $s->fullname;
                }
                $sem_name = $mform->createElement('static', 'semester_name', get_string('semester_name', 'local_request'), $mysemvalue);
                $mform->insertElementBefore($sem_name, 'addschool');
            }
        }
    }
Exemple #21
0
require_once($CFG->libdir . '/formslib.php');

$id = optional_param('id', -1, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/request/courseexem.php');
$systemcontext = context_system::instance();
require_login();
$context = context_system::instance();
$PAGE->set_context($systemcontext);

if (!isloggedin() || isguestuser()) {
    print_error('You dont have permissions');
}
$returnurl = new moodle_url($CFG->wwwroot . '/local/request/course_exem.php');
$hierarchy = new hierarchy();
$requestid = new requests();
/* -Checking weather student have any current Semester- */

$conf = new object();
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('requestcourseexem', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->set_title($strheading);
$tool = new stdClass();
$tool->id = -1;

$maxfiles = 99;
$maxbytes = $CFG->maxbytes;
$definitionoptions = array('trusttext' => true, 'subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'context' => $context);
$attachmentoptions = array('subdirs' => false, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes);
$myform = new courseexem_form(null, array('definitionoptions' => $definitionoptions, 'attachmentoptions' => $attachmentoptions));
Exemple #22
0
if (!isloggedin() || isguestuser()) {

    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('requisitions_id', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('newrequest', 'local_request'));
$PAGE->set_title($strheading);

$mform = new requestid_form();
$hierarchy = new hierarchy();
$nexturl = $CFG->wwwroot . '/local/request/request_id.php';
//Form processing and displaying is done here
$x = optional_param('schoolid', 0, PARAM_INT);
$requestid = new requests();
global $USER;
if ($mform->is_cancelled()) {
    /* if click on cancel it redirects us to request_id.php file */
    redirect($nexturl);
} else if ($fromform = $mform->get_data()) {
    /* presence of data */
    if (isset($fromform->school_name)) {
        $schoolid = $fromform->school_name;
        if (isset($fromform->program_name)) {
            $pro_id = $fromform->program_name;
            $semesters = $requestid->semester($fromform->school_name, $fromform->program_name);
            foreach ($semesters as $sem) {
                $sem->id;
            }
        }
Exemple #23
0
 public function get_userdetails_accounts($userid)
 {
     global $DB, $OUTPUT;
     $hierarchy = new hierarchy();
     $requests = new requests();
     $help_desk_lib = new user_filtering_accounts();
     $user = $DB->get_record('user', array('id' => $userid));
     $local_user = $DB->get_record('local_users', array('userid' => $userid));
     $local_user_data = $DB->get_record('local_userdata', array('userid' => $userid));
     $fullname = $user->firstname . ' ' . $user->lastname;
     $out = '<div class="userprofilebox clearfix"><div class="profilepicture">';
     $out .= $OUTPUT->user_picture($user, array('size' => 50));
     $out .= '</div>';
     $table = new html_table();
     $table->id = 'accounts_viewmore';
     $table->size = array('20%', '80%');
     $table->align = array('right', 'left');
     $get_alldepartments = $hierarchy->get_alldepartments($user->id);
     $get_allmyactivesemester = $hierarchy->get_allmyactivesemester($user->id);
     $student_semesters = student_semesters($user->id);
     //School with department
     if ($school = $requests->school($user->id)) {
         foreach ($school as $schools) {
             $schoolid = $schools->id;
             $schoolname = $schools->fullname;
             $s1[] = $schoolname;
             $programs = $requests->program($schoolid, $user->id);
             foreach ($programs as $program) {
                 $proid = $program->id;
                 $p[] = $DB->get_field('local_program', 'fullname', array('id' => $proid));
                 if ($serviceid = $requests->service($schoolid, $proid, $user->id)) {
                     $s3[] = $serviceid->serviceid;
                 }
             }
         }
         if ($s1) {
             $s2 = implode(',&nbsp;', $s1);
             $myschools = "<p><b>School: </b>" . $s2 . "</p>";
         }
         if ($p) {
             $pro = implode('&nbsp;', $p);
             $myschools .= "<span style='margin-left: 6%;'><b>Program: </b>" . $pro . "</span>";
         }
     }
     //End of school
     print_object($help_desk_lib->user_enrolled_courses($userid));
     $table->data = array(array(get_string('username'), $user->username), array(get_string('fullname'), $fullname), array(get_string('firstname'), $user->firstname), array(get_string('lastname'), $user->lastname), array(get_string('email'), $user->email), array(get_string('phone'), $user->phone1), array(get_string('phone2'), $user->phone2), array(get_string('dob', 'local_admission'), date('Y-m-d', $local_user->dob)), array(get_string('doj', 'local_users'), date('Y-m-d', $local_user->timecreated)), array(get_string('genderheading', 'local_admission'), $local_user->gender), array(get_string('serviceid', 'local_users'), implode(',&nbsp;', $s3)), array(get_string('idnumber'), $user->idnumber), array(get_string('hschool', 'local_users'), $local_user->primaryschoolname), array(get_string('primaryyear', 'local_admission'), $local_user->primaryyear), array(get_string('score', 'local_admission'), $local_user->primaryscore), array(get_string('pcountry', 'local_admission'), $local_user->primaryplace), array(get_string('contactname', 'local_admission'), $local_user->fathername), array(get_string('hno', 'local_admission'), $local_user->currenthno), array(get_string('pob', 'local_admission'), $local_user->pob), array(get_string('city'), $local_user->region), array(get_string('state'), $local_user->state), array(get_string('icqnumber'), $user->icq), array(get_string('skypeid'), $user->skype), array(get_string('yahooid'), $user->yahoo), array(get_string('aimid'), $user->aim), array(get_string('msnid'), $user->msn), array(get_string('language'), $user->lang), array(get_string('timezone'), usertimezone($user->timezone)), array(get_string('departments', 'local_help_desk'), $hierarchy->get_alldepartments($user->id)), array(get_string('activesemister', 'local_help_desk'), $hierarchy->get_allmyactivesemester($user->id)), array(get_string('studentsemister', 'local_help_desk'), student_semesters($user->id)), array(get_string('myschools', 'local_help_desk'), $myschools));
     //get_string('dob', 'local_admission') . "</b></;" . date("Y-m-d", $local_users->dob) . "
     //get_string('doj', 'local_users') . "</b></td>< date("Y-m-d", $local_users->timecreated)
     //get_string('genderheading', 'local_admission')nbsp;&nbsp;" . $local_users->gender . "</
     //print_object($get_alldepartments);
     //print_object($get_allmyactivesemester);
     //print_object($student_semesters);
     //print_object(date('D M Y', $user->dob));
     $edit_url = new moodle_url('/user/edit.php', array('id' => $userid));
     $out .= html_writer::tag('a', 'EDIT', array('href' => $edit_url, 'id' => 'EDIT'));
     $out .= html_writer::table($table);
     return $out;
 }
require_once('../../local/request/lib/lib.php');
$var = optional_param('x', 0, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/request/approval_transcript.php');
$systemcontext =context_system::instance();
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser()) {

    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('transcriptapprovals', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->set_title($strheading);
$requestpro = new requests();
$data = array();
global $USER;
$url = '../../local/request/requesttranscript.php';
if ($var) {
    redirect($url);
}
$data = array();
echo $OUTPUT->header();
$requests = $DB->get_records('local_request_transcript');

foreach ($requests as $request) {
    $list = array();
    $buttons = array();
    $details = $DB->get_record_sql("select lud.schoolid,luc.semesterid,lud.userid,lud.serviceid,lud.programid
        from {local_userdata} lud
Exemple #25
0
 public static function http_client($url, $method = 'GET', $fields)
 {
     $method = strtoupper($method);
     if (!self::_is_url($url)) {
         self::$error = "You have requested URL ({$url}) is not a valid HTTP address";
         return false;
     }
     // 如果是 get 方式,直接拼凑一个 url 出来
     if ($method == 'GET' && !empty($fields)) {
         $url = $url . (strpos($url, "?") === false ? "?" : "&") . http_build_query($fields);
     }
     $parse_url = parse_url($url);
     if (empty($parse_url) || empty($parse_url['host']) || !in_array($parse_url['scheme'], array('http', 'https'))) {
         self::$error = "No connection adapters were found for '{$url}'";
         return false;
     }
     $scheme = $parse_url['scheme'];
     $domain = $parse_url['host'];
     // 随机绑定 hosts,做负载均衡
     //if (self::$hosts)
     //{
     //$host = $parse_url['host'];
     //$key = rand(0, count(self::$hosts)-1);
     //$ip = self::$hosts[$key];
     //$url = str_replace($host, $ip, $url);
     //self::$headers['Host'] = $host;
     //}
     curl_setopt(self::$ch, CURLOPT_URL, $url);
     if ($method != 'GET') {
         // 如果是 post 方式
         if ($method == 'POST') {
             curl_setopt(self::$ch, CURLOPT_POST, true);
         } else {
             self::$headers['X-HTTP-Method-Override'] = $method;
             curl_setopt(self::$ch, CURLOPT_CUSTOMREQUEST, $method);
         }
         curl_setopt(self::$ch, CURLOPT_POSTFIELDS, $fields);
     }
     $cookies = self::get_cookies();
     $domain_cookies = self::get_cookies($domain);
     $cookies = array_merge($cookies, $domain_cookies);
     // 是否设置了cookie
     if (!empty($cookies)) {
         foreach ($cookies as $key => $value) {
             $cookie_arr[] = $key . "=" . $value;
         }
         $cookies = implode("; ", $cookie_arr);
         curl_setopt(self::$ch, CURLOPT_COOKIE, $cookies);
     }
     if (self::$headers) {
         $headers = array();
         foreach (self::$headers as $k => $v) {
             $headers[] = $k . ": " . $v;
         }
         curl_setopt(self::$ch, CURLOPT_HTTPHEADER, $headers);
     }
     curl_setopt(self::$ch, CURLOPT_ENCODING, 'gzip');
     if (self::$proxies) {
         if (!empty(self::$proxies[$scheme])) {
             curl_setopt(self::$ch, CURLOPT_PROXY, self::$proxies[$scheme]);
         }
     }
     // header + body,header 里面有 cookie
     curl_setopt(self::$ch, CURLOPT_HEADER, true);
     self::$raw = curl_exec(self::$ch);
     //var_dump($data);
     self::$info = curl_getinfo(self::$ch);
     self::$status_code = self::$info['http_code'];
     if (self::$raw === false) {
         self::$error = ' Curl error: ' . curl_error(self::$ch);
     }
     // 关闭句柄
     curl_close(self::$ch);
     // 请求成功之后才把URL存起来
     self::$url = $url;
     self::$content = self::get_response_body($domain);
     //$data = substr($data, 10);
     //$data = gzinflate($data);
     return self::$content;
 }
Exemple #26
0
 * @copyright  2013 rajuadla <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once(dirname(__FILE__) . '/../../config.php');
require_once('../../local/request/lib/lib.php');
require_once('../../local/lib.php');
global $USER, $PAGE;

$id = required_param('id', PARAM_INT);
$approve = optional_param('approve', 0, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/request/exemdetails.php');
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
$PAGE->set_heading($SITE->fullname);
$requestss = new requests();
require_login();
if (!has_capability('local/collegestructure:manage', $systemcontext)) {
    print_error('You dont have permissions');
}

$strheading = get_string('course_exem', 'local_request');
$PAGE->navbar->add($strheading, new moodle_url('/local/request/approveexem.php'));
$PAGE->navbar->add(get_string('viewdetails', 'local_request'));
$PAGE->set_title($strheading);

$data = array();
echo $OUTPUT->header();

echo $OUTPUT->heading(get_string('viewdetails', 'local_request'));
Exemple #27
0
require_once('../../local/request/lib/lib.php');
$var = optional_param('x', 0, PARAM_INT);
$PAGE->set_pagelayout('admin');
$PAGE->set_url('/local/request/request_profile.php');
$systemcontext = context_system::instance();
$PAGE->set_context($systemcontext);
require_login();
if (!isloggedin() || isguestuser() || is_siteadmin()) {
    print_error('You dont have permissions');
}
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('requisitions_profile', 'local_request');
$PAGE->navbar->add($strheading);
$PAGE->navbar->add(get_string('view', 'local_request'));
$PAGE->set_title($strheading);
$requestpro = new requests();
$data = array();
global $USER;
$url = '../../local/request/requestprofile.php';
if ($var) {
    redirect($url);
}
$data = array();
echo $OUTPUT->header();

if ($requests = $DB->get_records('local_request_profile_change', array('studentid' => $USER->id))) {
    foreach ($requests as $request) {
        $list = array();
        $serviceid = $requestpro->service($request->schoolid, $request->programid);
        $list[] = $serviceid->serviceid;
        $list[] = $DB->get_field('local_school', 'fullname', array('id' => $request->schoolid));