How i can get "visible" in object course_modeinfo

How i can get "visible" in object course_modeinfo

by stephane ngov -
Number of replies: 1

I all,

in moodle 2.5 field "modinfo" is serialize in table course,

but in 2.6 this fileld in not here,

I try retrive ressource, this is a piece my script

        public function piocheInfo($res_act) { //ressource ou activite
        $sql = "SELECT * FROM {resource} WHERE name  LIKE '%" . $this->motcle . "%' "; //on pioche dans mode info
        echo $sql;

        $result = $this->db->get_records_sql($sql);
       

        foreach ($result as $R) { //recherche dans chaque cours les fichiers du mot clef
            echo "<h1>" . $R->course . "</h1>"; //en fonction du numéro de cours choisi on test si on est autoriser à piocher dedant
         //   $pioche_ok = $this->authShow($R->id, $R->visible);
        $modinfo = get_fast_modinfo($R->course);
        var_dump($modinfo);

 

this is my screen

SELECT * FROM {resource} WHERE name LIKE '%test%'

273

object(course_modinfo)[899]
  private 'course' => 
    object(stdClass)[907]
      public 'id' => 

string

 '273' (length=3)
      public 'category' => 

string

 '11' (length=2)
      public 'sortorder' => 

string

 '50004' (length=5)
      public 'fullname' => 

string

 'S09.04-Maladies Parasitaires des Ruminants' (length=42)
      public 'shortname' => 

string

 'S09.04-parasito.ru' (length=18)
      public 'idnumber' => 

string

 '09.04' (length=5)
      public 'summary' => 

string

 '<p><span style="color: #888888;"><strong>Objectifs d'enseignement :</strong> ....' (length=387)
      public 'summaryformat' => 

string

 '1' (length=1)
      public 'format' => 

string

 'topics' (length=6)
      public 'showgrades' => 

string

 '1' (length=1)
      public 'newsitems' => 

string

 '5' (length=1)
      public 'startdate' => 

string

 '1284760800' (length=10)
      public 'marker' => 

string

 '0' (length=1)
      public 'maxbytes' => 

string

 '26214400' (length=8)
      public 'legacyfiles' => 

string

 '2' (length=1)
      public 'showreports' => 

string

 '0' (length=1)
      public 'visible' => 

string

 '1' (length=1)
      public 'visibleold' => 

string

'1' (length=1) ....

How i can do for get  data visible ??

public 'visible' => string '1' (length=1)

WHERE is the file path for retrieve méthode get "visible" WHERE is the object course_modeinfo ?

thanks for help me smile

 

 

 

 

 

 

Average of ratings: -
In reply to stephane ngov

Re: How i can get "visible" in object course_modeinfo

by stephane ngov -

i resolut my solution with sql join left

 

        $sql ="SELECT R.course AS id_cours ,C.visible AS is_visible
        FROM resource  R
        LEFT JOIN course C
        ON R.course = C.id
        WHERE
        name  LIKE '%"  . $this->motcle . " %'";