public function refreshSessionTimeout($ts = false)
 {
     if (!$ts) {
         $ts = time();
     }
     $db_time = GcrInstitutionTable::getDbFormatTimestamp($ts);
     $this->app->updateMhrTable('usr', array('lastaccess' => $db_time), array('id' => $this->obj->id));
 }
 public function createEclassroom($mhr_user, $eschool)
 {
     $is_institution_classroom = $this->getConfigVar('gc_eclassroom_create_institution');
     $mhr_user_obj = $mhr_user->getObject();
     if ($is_institution_classroom == 'on') {
         $params = array('displayname' => $mhr_user->getFullNameString(), 'registerallowed' => 0);
         if ($max_users = $this->getConfigVar('gc_eclassroom_max_users')) {
             $params['maxuseraccounts'] = $max_users;
         }
         $mhr_institution = $this->generateNewMhrInstitution($params);
         // set purchaser as institution admin on the new mhr_institution
         $params = array('usr' => $mhr_user_obj->id, 'institution' => $mhr_institution->name, 'ctime' => GcrInstitutionTable::getDbFormatTimestamp(time()), 'admin' => 1);
         $mhr_usr_institution = $this->insertIntoMhrTable('usr_institution', $params);
         $params = array('instancename' => $mhr_institution->displayname, 'institution' => $mhr_institution->name, 'authname' => 'internal');
         $mhr_auth_instance = $this->insertIntoMhrTable('auth_instance', $params);
     }
     // create new eclassroom
     $eclassroom = new GcrEclassroom();
     $eclassroom->setEschoolId($eschool->getShortName());
     $eclassroom->setUserId($mhr_user_obj->id);
     $eclassroom->setUserInstitutionId($this->short_name);
     if ($is_institution_classroom == 'on') {
         $eclassroom->setMhrInstitutionName($mhr_institution->name);
     }
     $eclassroom->save();
     return $eclassroom;
 }