Пример #1
0
 static function getNoticesInModeCustom($fields)
 {
     extract($fields);
     $notes = new NotesPDF();
     if ($tag == '%') {
         $qry = 'select distinct g.noticeid as noticeid' . ' from grades g, group_inbox gr, notice_tag nt, notice n, profile p' . ' where g.noticeid = gr.notice_id' . ' and g.grade LIKE \'' . $grade . '\'' . ' and gr.group_id = ' . $idGroup . ' and gr.notice_id = n.id' . ' and n.profile_id = p.id' . ' and p.nickname LIKE \'' . $nick . '\'';
     } else {
         $qry = 'select distinct g.noticeid as noticeid' . ' from grades g, group_inbox gr, notice_tag nt, notice n, profile p' . ' where g.noticeid = gr.notice_id' . ' and g.grade LIKE \'' . $grade . '\'' . ' and gr.group_id = ' . $idGroup . ' and gr.notice_id = nt.notice_id' . ' and nt.tag LIKE \'' . $tag . '\'' . ' and n.id = nt.notice_id' . ' and n.profile_id = p.id' . ' and p.nickname LIKE \'' . $nick . '\'';
     }
     $notes->query($qry);
     // all select fields will
     // be written to fields of the Grade object. It is required that
     // select fields are named after the Grade fields.
     $noticesids = array();
     while ($notes->fetch()) {
         $noticesids[] = $notes->noticeid;
     }
     $notes->free();
     return $noticesids;
 }