Exemple #1
0
   public function get_content() {
     global $DB;
     if ($this->content !== null) {
       return $this->content;
     }
       global $CFG, $USER, $PAGE;
       $this->content = new stdClass();
       require_once($CFG->dirroot.'/blocks/queries/lib.php');
       require_once($CFG->dirroot.'/blocks/queries/commentform.php');
       require_once($CFG->dirroot.'/blocks/queries/queries_form.php');
       
       //query to enrol users courses particulars
       $courses = enrol_get_users_courses($USER->id);
     
       //calling function for if login user instructor or not
       $instructorlogin = block_queries_getrole_user($courses,'instructor');
     
       //calling function for if login user registrar or not
       $registrarlogin = block_queries_getrole_user($courses,'registrar');
       
       //calling function for if login user student or not
       $studentlogin = block_queries_getrole_user($courses,'student');
       
       /************calling function for getting data to the logged in user*************/
       $this->content->text = block_queries_display_view($USER,$instructorlogin,$registrarlogin,$studentlogin);
 
       $this->content->footer = '';
       $this->page->requires->js('/blocks/queries/js/commentform_popup.js');
       // Return the content object
       return $this->content;
   }
Exemple #2
0
          else{
             $test .= html_writer:: tag('p',get_string('nocomments','block_queries'));
          }        
          /*********end of code for display comments in toggle-starts here************/
          $test.='</span></div></div>';
          $test.= $popup;
          $row[]=$test;
          $data[]=$row;     
       }
    }
 }
 //for login user is a registrar
 
 $courses = enrol_get_users_courses($USER->id);
 
 $registrarlogin = block_queries_getrole_user($courses,'registrar');
 
 if(!empty($registrarlogin)){
    $registrarresponses = $DB->get_records_sql("SELECT * FROM {block_queries} WHERE userid = $USER->id AND userrole = 'registrar' ORDER BY id DESC");
    $data = array();
    foreach($registrarresponses as $registrarresponse){
       $row = array();
       $reg_id = $registrarresponse->id;
       $postedby = $registrarresponse->postedby;
       $posteduser = $DB->get_record_sql("SELECT * FROM {user} WHERE id=$postedby");
       $studentname = fullname($posteduser);
       $date_registrar = date("d/m/y h:i a",$registrarresponse->timecreated);
       if($registrarresponse->status == 0){
          $ifelse_registrar = get_string('notresponded','block_queries'); 
       }else {
          $ifelse_registrar = get_string('responded','block_queries');