コード例 #1
0
 public function render($datas)
 {
     $render_datas = array();
     $render_datas['legends'] = array();
     $render_datas['events'] = array();
     $nb_displayed = 0;
     $styles = array();
     $calendar = array();
     $events = array();
     if (count($datas['events'])) {
         foreach ($datas['events'] as $event) {
             if ($event['event_start']) {
                 $events[] = $event;
                 $styles[$event['id_type']] = array("color" => $event['color'], "calendar" => $this->format_text($event['calendar']));
                 if ($nb_displayed < $this->parameters['nb_displayed_events_under']) {
                     $event['link'] = $this->get_constructed_link("article", $event['id']);
                     $render_datas['events'][] = $event;
                     $nb_displayed++;
                 }
             }
         }
     }
     $html_to_display = "\n\t\t<div id='cms_module_calendar_" . $this->id . "' data-dojo-props='onChange : cms_module_agenda_highlight_events,getClassForDate:cms_module_agenda_get_class_day'; dojoType='dijit.Calendar' style='width:100%;'></div>";
     $html_to_display .= "\n\t\t\t<style>\n\t\t";
     foreach ($styles as $id => $style) {
         $html_to_display .= "\n\t\t\t\t#" . $this->get_module_dom_id() . " td.cms_module_agenda_event_" . $id . " {\n\t\t\t\t\tbackground : " . $style["color"] . ";\n\t\t\t\t}\n\t\t\t\t#" . $this->get_module_dom_id() . " .cms_module_agenda_view_calendar_eventslist .cms_module_agenda_event_" . $id . " {\n\t\t\t\t\tcolor : " . $style["color"] . ";\n\t\t\t\t}\n\t\t";
     }
     $html_to_display .= "\n\t\t\t</style>\n\t\t";
     $html_to_display .= "\n\t\t<script type='text/javascript'>\n\t\t\tvar events = " . json_encode($this->utf8_encode($events)) . ";\n\t\t\n\t\t\tfunction cms_module_agenda_get_class_day(date,locale){\n\t\t\t\tvar classname='';\n\t\t\t\tdojo.forEach(events,function (event){\n\t\t\t\t\tstart_day = new Date(event['event_start']['time']*1000);\n\t\t\t\t\tstart_day.setHours(1,0,0,0);\n\t\t\t\t\tif(event['event_end']){\n\t\t\t\t\t\tend_day = new Date(event['event_end']['time']*1000);\n\t\t\t\t\t\tend_day.setHours(1,0,0,0);\n\t\t\t\t\t}else end_day = false;\n\t\t\t\t\tif((date.valueOf()>=start_day.valueOf() && (end_day && date.valueOf()<=end_day.valueOf())) || date.valueOf()==start_day.valueOf()){\n\t\t\t\t\t\tif(classname) classname+=' ';\n\t\t\t\t\t\tclassname+='cms_module_agenda_event_'+event.id_type;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn classname;\n\t\t\t}\n\t\t\n\t\t\tfunction cms_module_agenda_highlight_events(value){\n\t\t\t\tif(value){\n\t\t\t\t\trequire(['dojo/date'],function(date){\n\t\t\t\t\t\tvar current_events = new Array();\n\t\t\t\t\t\tdojo.forEach(events,function (event){\n\t\t\t\t\t\t\tstart_day = new Date(event['event_start']['time']*1000);\n\t\t\t\t\t\t\tif(event['event_end']){\n\t\t\t\t\t\t\t\tend_day = new Date(event['event_end']['time']*1000);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//juste une date ou dates début et fin\n\t\t\t\t\t\t\tif(date.difference(value, start_day, 'day') == 0 || (start_day && end_day && date.difference(value, start_day, 'day') <= 0 &&date.difference(value, end_day, 'day') >= 0 )){\n\t\t\t\t\t\t\t\tcurrent_events.push(event);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstart_day = end_day = false;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif(current_events.length == 1){\n\t\t\t\t\t\t\t//un seul évènement sur la journée, on l'affiche directement\n\t\t\t\t\t\t\tvar link = '" . $this->get_constructed_link("event", "!!id!!") . "';\n\t\t\t\t\t\t\tdocument.location = link.replace('!!id!!',current_events[0]['id']);\n\t\t\t\t\t\t}else if (current_events.length > 1){\n\t\t\t\t\t\t\t//plusieurs évènements, on affiche la liste...\n\t\t\t\t\t\t\tvar month = value.getMonth()+1;\n\t\t\t\t\t\t\tvar day =value.getDate();\n\t\t\t\t\t\t\tvar day = value.getFullYear()+'-'+(month >9 ? month : '0'+month)+'-'+(day > 9 ? day : '0'+day);\n\t\t\t\t\t\t\tvar link = '" . $this->get_constructed_link("eventslist", "!!date!!") . "';\n\t\t\t\t\t\t\tdocument.location = link.replace('!!date!!',day);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t</script>\n\t\t";
     $render_datas['calendar'] = $html_to_display;
     $render_datas['legends'] = $styles;
     //on rappelle le tout...
     return cms_module_common_view_django::render($render_datas);
 }
コード例 #2
0
 public function render($datas)
 {
     global $opac_notice_affichage_class;
     if (!$opac_notice_affichage_class) {
         $opac_notice_affichage_class = "notice_affichage";
     }
     // $datas => id de la notice
     $notice = $datas;
     $render_datas = array();
     $render_datas['record'] = array();
     if ($notice) {
         //on calcule le template de notices...
         $notice_class = new $opac_notice_affichage_class($notice);
         $notice_class->do_header();
         if ($notice_class->notice->niveau_biblio != "b") {
             $permalink = "index.php?lvl=notice_display&id=" . $notice_class->notice_id;
         } else {
             $permalink = "index.php?lvl=bulletin_display&id=" . $notice_class->bulletin_id;
         }
         $infos = array('header' => $notice_class->notice_header, 'link' => $permalink);
         if ($this->parameters['used_template']) {
             $tpl = new notice_tpl_gen($this->parameters['used_template']);
             $infos['content'] = $tpl->build_notice($notice);
         } else {
             $notice_class->do_isbd();
             $infos['content'] = $notice_class->notice_isbd;
         }
         $render_datas['record'] = $infos;
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }
 public function render($datas)
 {
     global $opac_notices_format;
     global $opac_etagere_order;
     // on gère l'ordre des étagères, id asc par défaut
     $critere = "id";
     $dir = "asc";
     if ($opac_etagere_order) {
         $etagere_order = explode(" ", trim($opac_etagere_order));
         if (trim($etagere_order[0]) == 'name' || trim($etagere_order[0]) == 'comment') {
             $critere = trim($etagere_order[0]);
         }
         if (isset($etagere_order[1])) {
             $dir = strtolower(trim($etagere_order[1]));
         }
     }
     $order = array();
     foreach ($datas['shelves'] as $shelf) {
         $order[] = $shelf[$critere];
     }
     if ($dir == 'desc') {
         array_multisort($order, SORT_DESC, $datas['shelves']);
     } else {
         array_multisort($order, SORT_ASC, $datas['shelves']);
     }
     //on gère l'affichage des notices
     foreach ($datas["shelves"] as $i => $shelve) {
         $datas['shelves'][$i]['records'] = contenu_etagere($shelve['id'], $this->parameters["nb_notices"], $opac_notices_format, "", 1, './index.php?lvl=etagere_see&id=!!id!!');
     }
     //on rappelle le tout...
     return parent::render($datas);
 }
コード例 #4
0
 public function render($datas)
 {
     for ($i = 0; $i < count($datas['watches']); $i++) {
         $datas['watches'][$i]['link'] = $this->get_constructed_link('watch', $datas['watches'][$i]['id']);
     }
     return parent::render($datas);
 }
コード例 #5
0
 public function render($datas)
 {
     $render_datas = array();
     $render_datas['item'] = array();
     $render_datas['item'] = $datas;
     //on rappelle le tout...
     return parent::render($render_datas);
 }
コード例 #6
0
 public function render($datas)
 {
     for ($i = 0; $i < count($datas['items']); $i++) {
         $datas['items'][$i]['link'] = $this->get_constructed_link('item', $datas['items'][$i]['id']);
         $tags = $datas['items'][$i]['tags'];
         for ($j = 0; $j < count($tags); $j++) {
             $datas['items'][$i]['tags'][$j]['link'] = $this->get_constructed_link('tag', $tags[$j]['id']);
         }
     }
     return parent::render($datas);
 }
コード例 #7
0
 public function render($datas)
 {
     $render_datas = array();
     $render_datas['title'] = "Liste d'évènements";
     $render_datas['events'] = array();
     foreach ($datas['events'] as $event) {
         $event['link'] = $this->get_constructed_link("article", $event['id']);
         $render_datas['events'][] = $event;
     }
     //on rappelle le tout...
     return cms_module_common_view_django::render($render_datas);
 }
コード例 #8
0
 public function render($datas)
 {
     $render = parent::render($datas);
     if ($this->parameters['visionneuse']) {
         for ($i = 0; $i < count($datas['documents']); $i++) {
             $str_to_replace = substr($render, strpos($render, $datas['documents'][$i]['url']) - 1, strlen($datas['documents'][$i]['url']) + 2);
             $render = str_replace($str_to_replace, "'#' onclick='open_visionneuse(open_cms_visionneuse_" . $this->id . "," . $datas['documents'][$i]['id'] . ");return false;',", $render);
         }
         $render .= "\n\t\t\t<script type='text/javascript'>\n\t\t\t\tfunction open_cms_visionneuse_" . $this->id . "(id){\n\t\t\t\t\tvar url = 'visionneuse.php?driver=pmb_document&lvl=visionneuse&cms_type=" . $datas['type_object'] . "&num_type=" . $datas['num_object'] . "';\n\t\t\t\t\tif(id){\n\t\t\t\t\t\turl+='&explnum='+id;\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById('visionneuseIframe').src = url;\n\t\t\t\t}\n\t\t\t</script>";
     }
     return $render;
 }
コード例 #9
0
 public function render($datas)
 {
     for ($i = 0; $i < count($datas['result']); $i++) {
         foreach ($datas['result'][$i] as $key => $value) {
             if (strpos($key, " ") !== false) {
                 $datas['result'][$i][str_replace(" ", "_", $key)] = $value;
                 unset($datas['result'][$i][$key]);
             }
             $datas['result'][$i][$key] = $this->charset_normalize($value, "utf-8");
         }
     }
     return parent::render($datas);
 }
コード例 #10
0
 public function render($datas)
 {
     //on rajoute nos éléments...
     //le titre
     if (!is_array($datas['items'])) {
         $datas['items'] = array();
     }
     foreach ($datas['items'] as $key => $item) {
         if ($item['link'] == $_SERVER['HTTP_REFERER']) {
             $datas['items'][$key]['current'] = true;
         }
     }
     //on rappelle le tout...
     return parent::render($datas);
 }
コード例 #11
0
 public function render($datas)
 {
     global $opac_url_base;
     $render_datas = array();
     $render_datas['sections'] = array();
     $render_datas['home'] = array('title' => $this->msg['home'], 'link' => $opac_url_base);
     foreach ($datas as $section) {
         $cms_section = cms_provider::get_instance("section", $section);
         $infos = $cms_section->format_datas(false, false);
         $infos['link'] = $this->get_constructed_link("section", $section);
         $render_datas['sections'][] = $infos;
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }
コード例 #12
0
 public function render($datas)
 {
     //on rajoute nos éléments...
     //le titre
     global $opac_url_base;
     $opac_url = substr($opac_url_base, strpos($opac_url_base, "://") + 3);
     if (!is_array($datas['items'])) {
         $datas['items'] = array();
     }
     foreach ($datas['items'] as $key => $item) {
         if (str_replace($opac_url, "", $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) == substr($item['link'], 2)) {
             $datas['items'][$key]['current'] = true;
         }
     }
     //on rappelle le tout...
     return parent::render($datas);
 }
コード例 #13
0
 public function render($datas)
 {
     //on rajoute nos éléments...
     //le titre
     $render_datas = array();
     $render_datas['title'] = "Liste d'articles";
     $render_datas['articles'] = array();
     if (is_array($datas)) {
         foreach ($datas as $article) {
             $cms_article = new cms_article($article);
             $infos = $cms_article->format_datas();
             $infos['link'] = $this->get_constructed_link("article", $article);
             $render_datas['articles'][] = $infos;
         }
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }
コード例 #14
0
 public function render($datas)
 {
     //on rajoute nos éléments...
     //le titre
     $render_datas = array();
     $render_datas['title'] = "Liste de rubriques";
     $render_datas['sections'] = array();
     foreach ($datas as $section) {
         $cms_section = new cms_section($section);
         $infos = $cms_section->format_datas();
         $infos['link'] = $this->get_constructed_link("section", $section);
         foreach ($infos['articles'] as $i => $article) {
             $infos['articles'][$i]['link'] = $this->get_constructed_link("article", $article["id"]);
         }
         $render_datas['sections'][] = $infos;
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }
 public function render($datas)
 {
     $newdatas = $new_datas['categories'] = array();
     //récupération des ids des classements de veilles...
     $categories = array();
     for ($i = 0; $i < count($datas['watches']); $i++) {
         if ($datas['watches'][$i]['category']) {
             $categories[] = $datas['watches'][$i]['category']['id'];
         } else {
             $newdatas['watches'][] = $datas['watches'][$i];
         }
         $datas['watches'][$i]['link'] = $this->get_constructed_link('watch', $datas['watches'][$i]['id']);
     }
     $categories = array_unique($categories);
     //on récupère les parents jusque la racine....
     $this->get_parent($categories);
     //on regénère une structure de données..;
     $newdatas['categories'] = $this->set_children(0, $datas);
     return parent::render($newdatas);
 }
コード例 #16
0
 public function render($datas)
 {
     $newdatas = array();
     $tags = array();
     for ($i = 0; $i < count($datas['items']); $i++) {
         $datas['items'][$i]['link'] = $this->get_constructed_link('item', $datas['items'][$i]['id']);
         if (count($datas['items'][$i]['tags'])) {
             for ($j = 0; $j < count($datas['items'][$i]['tags']); $j++) {
                 $datas['items'][$i]['tags'][$j]['link'] = $this->get_constructed_link('tag', $datas['items'][$i]['tags'][$j]['id']);
                 $tags[$datas['items'][$i]['tags'][$j]['label']]['items'][] = $datas['items'][$i];
                 $tags[$datas['items'][$i]['tags'][$j]['label']]['label'] = $datas['items'][$i]['tags'][$j]['label'];
                 $tags[$datas['items'][$i]['tags'][$j]['label']]['link'] = $datas['items'][$i]['tags'][$j]['link'];
             }
         } else {
             $newdatas['items'][] = $datas['items'][$i];
         }
     }
     ksort($tags);
     $newdatas['tags'] = $tags;
     return parent::render($newdatas);
 }
コード例 #17
0
 public function render($datas)
 {
     global $dbh;
     global $opac_url_base;
     global $opac_show_book_pics;
     global $opac_book_pics_url;
     global $opac_notice_affichage_class;
     global $opac_bannette_notices_depliables;
     global $opac_bannette_notices_format;
     global $opac_bannette_notices_order;
     global $liens_opac;
     if ($datas['id']) {
         $bannette = new bannette($datas['id']);
         $info_header = $bannette->construit_liens_HTML();
         $datas['info']['header'] = $info_header;
         $bannette->notice_tpl = $this->parameters['used_template'];
         $bannette->document_notice_tpl = $this->parameters['used_template'];
         $bannette->get_datas_content();
         $datas = array_merge($datas, $bannette->data_document);
     }
     return parent::render($datas);
 }
コード例 #18
0
 public function render($datas)
 {
     $datas = $this->add_links($datas);
     return parent::render($datas);
 }
 public function render($datas)
 {
     global $dbh;
     global $opac_url_base;
     global $opac_show_book_pics;
     global $opac_book_pics_url;
     global $opac_notice_affichage_class;
     global $opac_bannette_notices_depliables;
     global $opac_bannette_notices_format;
     global $opac_bannette_notices_order;
     global $liens_opac;
     if (!$opac_notice_affichage_class) {
         $opac_notice_affichage_class = "notice_affichage";
     }
     //on gère l'affichage des banettes
     foreach ($datas["bannettes"] as $i => $bannette) {
         $datas['bannettes'][$i]['link'] = $this->get_constructed_link('bannette', $datas['bannettes'][$i]['id']);
         if ($this->parameters['nb_notices']) {
             $limitation = " LIMIT " . $this->parameters['nb_notices'];
         }
         $requete = "select * from bannette_contenu, notices where num_bannette='" . $datas['bannettes'][$i]['id'] . "' \n\t\t\tand notice_id=num_notice";
         if ($opac_bannette_notices_order) {
             $requete .= " order by " . $opac_bannette_notices_order;
         }
         $requete .= " " . $limitation;
         $resultat = pmb_mysql_query($requete, $dbh);
         $cpt_record = 0;
         $datas["bannettes"][$i]['records'] = array();
         while ($r = pmb_mysql_fetch_object($resultat)) {
             $content = "";
             if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $r->thumbnail_url)) {
                 $code_chiffre = pmb_preg_replace('/-|\\.| /', '', $r->code);
                 $url_image = $opac_book_pics_url;
                 $url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "&noticecode=!!noticecode!!&vigurl=" . urlencode($r->thumbnail_url);
                 if ($r->thumbnail_url) {
                     $url_vign = $r->thumbnail_url;
                 } else {
                     if ($code_chiffre) {
                         $url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
                     } else {
                         $url_vign = $opac_url_base . "images/vide.png";
                     }
                 }
             }
             if ($this->parameters['used_template']) {
                 $tpl = new notice_tpl_gen($this->parameters['used_template']);
                 $content = $tpl->build_notice($r->num_notice);
             } else {
                 $notice_class = new $opac_notice_affichage_class($r->num_notice, $liens_opac);
                 $notice_class->do_header();
                 switch ($opac_bannette_notices_format) {
                     case AFF_BAN_NOTICES_REDUIT:
                         $content .= "<div class='etagere-titre-reduit'>" . $notice_class->notice_header_with_link . "</div>";
                         break;
                     case AFF_BAN_NOTICES_ISBD:
                         $notice_class->do_isbd();
                         $notice_class->genere_simple($opac_bannette_notices_depliables, 'ISBD');
                         $content .= $notice_class->result;
                         break;
                     case AFF_BAN_NOTICES_PUBLIC:
                         $notice_class->do_public();
                         $notice_class->genere_simple($opac_bannette_notices_depliables, 'PUBLIC');
                         $content .= $notice_class->result;
                         break;
                     case AFF_BAN_NOTICES_BOTH:
                         $notice_class->do_isbd();
                         $notice_class->do_public();
                         $notice_class->genere_double($opac_bannette_notices_depliables, 'PUBLIC');
                         $content .= $notice_class->result;
                         break;
                     default:
                         $notice_class->do_isbd();
                         $notice_class->do_public();
                         $notice_class->genere_double($opac_bannette_notices_depliables, 'autre');
                         $content .= $notice_class->result;
                         break;
                 }
             }
             $datas["bannettes"][$i]['records'][$cpt_record]['id'] = $r->num_notice;
             $datas["bannettes"][$i]['records'][$cpt_record]['title'] = $r->title;
             $datas["bannettes"][$i]['records'][$cpt_record]['link'] = $this->get_constructed_link("notice", $r->num_notice);
             $datas["bannettes"][$i]['records'][$cpt_record]['url_vign'] = $url_vign;
             $datas["bannettes"][$i]['records'][$cpt_record]['content'] = $content;
             $cpt_record++;
         }
     }
     //on rappelle le tout...
     return parent::render($datas);
 }
 public function render($datas)
 {
     global $opac_notice_affichage_class;
     global $opac_show_book_pics;
     global $opac_book_pics_url;
     global $opac_book_pics_msg;
     if (!$opac_notice_affichage_class) {
         $opac_notice_affichage_class = "notice_affichage";
     }
     //on rajoute nos éléments...
     //le titre
     $render_datas = array();
     $render_datas['title'] = $datas["title"];
     $render_datas['records'] = array();
     if (is_array($datas["records"])) {
         foreach ($datas["records"] as $notice) {
             //on calcule les templates pour chaque notices...
             $notice_class = new $opac_notice_affichage_class($notice);
             $notice_class->do_header();
             if ($notice_class->notice->niveau_biblio != "b") {
                 $notice_id = $notice_class->notice_id;
                 $is_bulletin = false;
             } else {
                 $notice_id = $notice_class->bulletin_id;
                 $is_bulletin = true;
             }
             if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $notice_class->notice->thumbnail_url)) {
                 $code_chiffre = pmb_preg_replace('/-|\\.| /', '', $notice_class->notice->code);
                 $url_image = $opac_book_pics_url;
                 $url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "&noticecode=!!noticecode!!&vigurl=" . urlencode($notice_class->notice->thumbnail_url);
                 if ($notice_class->notice->thumbnail_url) {
                     $url_vign = $notice_class->notice->thumbnail_url;
                 } else {
                     if ($code_chiffre) {
                         $url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
                     } else {
                         $url_vign = $opac_url_base . "images/vide.png";
                     }
                 }
             }
             $infos = array('id' => $notice_id, 'title' => $notice_class->notice->tit1, 'vign' => $url_vign, 'header' => $notice_class->notice_header, 'link' => $this->get_constructed_link("notice", $notice_id, $is_bulletin));
             if ($this->parameters['used_template']) {
                 $tpl = new notice_tpl_gen($this->parameters['used_template']);
                 $infos['content'] = $tpl->build_notice($notice);
             } else {
                 $notice_class->do_isbd();
                 $infos['content'] = $notice_class->notice_isbd;
             }
             $render_datas['records'][] = $infos;
         }
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }