本文整理汇总了PHP中H2o::parseString方法的典型用法代码示例。如果您正苦于以下问题:PHP H2o::parseString方法的具体用法?PHP H2o::parseString怎么用?PHP H2o::parseString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H2o
的用法示例。
在下文中一共展示了H2o::parseString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_datas
public function get_datas()
{
//on commence par récupérer l'identifiant retourné par le sélecteur...
$selector = $this->get_selected_selector();
if ($selector) {
$section_id = $selector->get_value();
$section_ids = $this->filter_datas("sections", array($section_id));
if ($section_ids[0]) {
$group_metadatas = parent::get_group_metadatas();
$datas = array();
$section = cms_provider::get_instance("section", $section_ids[0]);
$datas = $section->format_datas();
$datas["details"] = $datas;
$datas = array_merge($datas, parent::get_datas());
$datas['link'] = $this->get_constructed_link("section", $section_ids[0]);
$datas['logo_url'] = $datas["logo"]["big"];
foreach ($group_metadatas as $i => $metadatas) {
if (is_array($metadatas["metadatas"])) {
foreach ($metadatas["metadatas"] as $key => $value) {
try {
$group_metadatas[$i]["metadatas"][$key] = H2o::parseString($value)->render($datas);
} catch (Exception $e) {
}
}
}
}
return $group_metadatas;
}
}
return false;
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:cms_module_metadatas_datasource_metadatas_section.class.php
示例2: render
public function render($datas)
{
if (!$datas['id']) {
$datas['id'] = $this->get_module_dom_id();
}
if (!$datas['get_vars']) {
$datas['get_vars'] = $_GET;
}
if (!$datas['post_vars']) {
$datas['post_vars'] = $_POST;
}
if (!$datas['session_vars']) {
$datas['session_vars']['view'] = $_SESSION['opac_view'];
$datas['session_vars']['id_empr'] = $_SESSION['id_empr_session'];
}
if (!$datas['env_vars']) {
$datas['env_vars']['script'] = basename($_SERVER['SCRIPT_NAME']);
$datas['env_vars']['request'] = basename($_SERVER['REQUEST_URI']);
}
try {
$html = H2o::parseString($this->parameters['active_template'])->render($datas);
} catch (Exception $e) {
$html = $this->msg["cms_module_common_view_error_template"];
}
return $html;
}
示例3: gen_print_card
function gen_print_card($data, $tpl = '')
{
global $msg;
$default_template = "@\n{% for empr in empr_list %}\n!\n{{empr.name}} {{empr.fistname}}\n!\nHfh k{{empr.cb}}\n{% endfor %}\nVA @";
if (!$tpl) {
$tpl = $default_template;
}
return H2o::parseString($tpl)->render($data);
}
示例4: get_datas
public function get_datas()
{
global $opac_show_book_pics;
global $opac_book_pics_url;
global $opac_url_base;
//on commence par récupérer l'identifiant retourné par le sélecteur...
if ($this->parameters['selector'] != "") {
for ($i = 0; $i < count($this->selectors); $i++) {
if ($this->selectors[$i]['name'] == $this->parameters['selector']) {
$selector = new $this->parameters['selector']($this->selectors[$i]['id']);
break;
}
}
$notice = $selector->get_value();
if (is_array($notice)) {
$notice = $notice[0];
}
if ($notice) {
$group_metadatas = parent::get_group_metadatas();
$datas = array();
$notice_class = new notice($notice);
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $notice_class->thumbnail_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $notice_class->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($notice_class->thumbnail_url);
if ($notice_class->thumbnail_url) {
$url_vign = $notice_class->thumbnail_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = $opac_url_base . "images/vide.png";
}
}
}
$datas = array('id' => $notice_class->id, 'title' => $notice_class->tit1, 'link' => $this->get_constructed_link("notice", $notice_class->id), 'logo_url' => $url_vign, 'header' => $notice_class->notice_header, 'resume' => $notice_class->n_resume, 'content' => $content, 'type' => 'notice');
$datas["details"] = $datas;
$datas = array_merge($datas, parent::get_datas());
$datas['link'] = $this->get_constructed_link("notice", $notice_class->id);
foreach ($group_metadatas as $i => $metadatas) {
if (is_array($metadatas["metadatas"])) {
foreach ($metadatas["metadatas"] as $key => $value) {
try {
$group_metadatas[$i]["metadatas"][$key] = H2o::parseString($value)->render($datas);
} catch (Exception $e) {
}
}
}
}
return $group_metadatas;
}
}
return false;
}
示例5: render
public static function render($id, $data)
{
global $dbh, $charset;
$requete = "SELECT * FROM bannette_tpl WHERE bannettetpl_id='" . $id . "' LIMIT 1 ";
$result = @pmb_mysql_query($requete, $dbh);
if (pmb_mysql_num_rows($result)) {
$temp = pmb_mysql_fetch_object($result);
$data_to_return = H2o::parseString($temp->bannettetpl_tpl)->render($data);
if ($charset != "utf-8") {
$data_to_return = utf8_decode($data_to_return);
}
return $data_to_return;
}
}
示例6: render
public function render($datas)
{
$html2return = "";
if (count($datas['records'])) {
$id = "carousel_" . $this->get_module_dom_id();
$datas['id'] = $this->get_module_dom_id();
$html2return .= H2o::parseString($this->parameters['active_template'])->render($datas);
$html2return .= "\n\t\t<script type='text/javascript'>\n\t\t\tjQuery(document).ready(function() {";
if ($this->parameters['mode'] == "horizontal") {
$html2return .= "\n\t\t\t\tvar item_width = document.getElementById('" . $this->get_module_dom_id() . "').offsetWidth/" . $this->parameters['display_quantity'] . ";\n\t\t\t\tvar items = document.getElementsByClassName('" . $this->get_module_dom_id() . "_item');\n\t\t\t\tfor(var i=0 ; i<items.length ; i++){\n\t\t\t\t\titems[i].style.width = item_width+'px';\n\t\t\t\t}";
} else {
$html2return .= "\n\t\t\t\tvar item_width = document.getElementById('" . $this->get_module_dom_id() . "').offsetHeight/" . $this->parameters['display_quantity'] . ";\n\t\t\t\tvar items = document.getElementsByClassName('" . $this->get_module_dom_id() . "_item');\n\t\t\t\tfor(var i=0 ; i<items.length ; i++){\n\t\t\t\t\titems[i].style.height = item_width+'px';\n\t\t\t\t}";
}
$html2return .= "\n\t\t\t\tjQuery('#" . $id . "').bxSlider({\n\t\t\t\t\tmode: '" . $this->parameters['mode'] . "',\n\t\t\t\t\tspeed: " . $this->parameters['speed'] . ",\n\t\t\t\t\tpause: " . $this->parameters['pause'] . ",\n\t\t\t\t\tauto: true,\n\t\t\t\t\tautoStart: " . ($this->parameters['autostart'] ? "true" : "false") . ",\n\t\t\t\t\tautoHover: " . ($this->parameters['autohover'] ? "true" : "false") . ",\n\t\t\t\t\tautoControls: false,\n\t\t\t\t\tcontrols:true,\n\t\t\t\t\tprevImage: '',\n\t\t\t\t\tprevText: '',\n\t\t\t\t\tnextImage: '',\n\t\t\t\t\tnextText: '',\n\t\t\t\t\tstartImage: '',\n\t\t\t\t\tstartText: '',\n\t\t\t\t\tstopImage: '',\n\t\t\t\t\t//stopText:'',\n\t\t\t\t\tpager: " . ($this->parameters['pager'] ? "true" : "false") . ",\n\t\t\t\t\trandomStart: false,\n\t\t\t\t\tdisplaySlideQty: " . $this->parameters['display_quantity'] . ",\n\t\t\t\t\tmoveSlideQty: " . $this->parameters['slide_quantity'] . "\n\t\t\t\t});\n\t\t\t});\n\t\t</script>";
}
return $html2return;
}
示例7: render
public function render($datas)
{
if (!$datas['get_vars']) {
$datas['get_vars'] = $_GET;
}
if (!$datas['post_vars']) {
$datas['post_vars'] = $_POST;
}
if (!$datas['session_vars']) {
$datas['session_vars']['view'] = $_SESSION['opac_view'];
$datas['session_vars']['id_empr'] = $_SESSION['id_empr_session'];
}
if (!$datas['env_vars']) {
$datas['env_vars']['script'] = basename($_SERVER['SCRIPT_NAME']);
$datas['env_vars']['request'] = basename($_SERVER['REQUEST_URI']);
}
return H2o::parseString($this->parameters['active_template'])->render($datas);
}
示例8: get_datas
public function get_datas()
{
$datas = array();
$selector = $this->get_selected_selector();
$this->set_module_class_name("cms_module_sparql");
if ($selector->get_value()) {
//la config ARC2 varie en fonction de l'origine du server SPARL
$selector_config = new $this->managed_datas['stores'][$selector->get_value()]['selector']($this->managed_datas['stores'][$selector->get_value()]['selector_id']);
$config = array();
switch ($this->managed_datas['stores'][$selector->get_value()]['selector']) {
case "cms_module_sparql_selector_endpoint":
$config = array('remote_store_endpoint' => $selector_config->get_value(), 'remote_store_timeout' => 15);
$store = ARC2::getRemoteStore($config);
break;
}
if ($this->parameters['query']) {
$querydatas = array('get_vars' => $_GET, 'post_vars' => $_POST);
try {
$query = H2o::parseString($this->parameters['query'])->render($querydatas);
$rows = $store->query($query, 'rows');
if (!$rows) {
$this->debug("Execution failed : " . $query);
$errors = $store->getErrors();
foreach ($errors as $error) {
$this->debug(utf8_decode($error));
}
} else {
// $this->charset_normalize($rows, "utf-8");
}
} catch (Exception $e) {
$rows = array();
}
}
}
$this->debug($query);
$datas['result'] = $rows;
return $datas;
}
示例9: render
public function render($datas)
{
global $opac_default_style;
$html2return = "";
//TODO VERIF DOM ET APPEL AU JS
if (count($datas['records'])) {
$id = "carousel_" . $this->get_module_dom_id();
$datas['id'] = $this->get_module_dom_id();
//pour la no-image, on cherche celle du style, du common, du dossier image de base, sinon on sert celle par défaut
$path = "./styles/" . $opac_default_style . "/images/";
if (!file_exists(realpath($path) . $this->parameters['no_image'])) {
$path = "./styles/common/images/";
if (!file_exists(realpath($path) . $this->parameters['no_image'])) {
$path = "./images/";
if (!file_exists(realpath($path) . $this->parameters['no_image'])) {
$path = "./images/";
$this->parameters['no_image'] = "no_image_carousel.jpg";
}
}
}
$datas['no_image_url'] = $path . $this->parameters['no_image'];
for ($i = 0; $i < count($datas['records']); $i++) {
if ($datas['records'][$i]['vign'] == "") {
$datas['records'][$i]['vign'] = $datas['no_image_url'];
}
}
$html2return .= H2o::parseString($this->parameters['active_template'])->render($datas);
$html2return .= "\n\t\t<script type='text/javascript'>\n\t\t\tjQuery(document).ready(function() {\n\t\t\t\tjQuery('#" . $id . "').bxSlider({\n\t\t\t\t\t//parametres generaux\n\t\t\t\t\tmode: \t\t\t\t\t'" . $this->parameters['mode'] . "',\n\t\t\t\t\tspeed: \t\t\t\t\t" . $this->parameters['speed'] . ",\n\t\t\t\t\tpause: \t\t\t\t\t" . $this->parameters['pause'] . ",\t\n\t\t\t\t\tautoStart: \t\t\t\t" . ($this->parameters['autostart'] ? "true" : "false") . ",\n\t\t\t\t\tautoHover: \t\t\t\t" . ($this->parameters['autohover'] ? "true" : "false") . ",\t\n\t\t\t\t\tpager: \t\t\t\t\t" . ($this->parameters['pager'] ? "true" : "false") . ",\t\n\t\t\t\t\tmoveSlides : \t\t\t'" . $this->parameters['slide_quantity'] . "',\t\n\t\t\t\t\tminSlides: \t\t\t\t'" . $this->parameters['display_min_quantity'] . "',\t\n\t\t\t\t\tmaxSlides: \t\t\t\t'" . $this->parameters['display_max_quantity'] . "',\n\t\t\t\t\tslideWidth: \t\t\t'" . $this->parameters['slide_width'] . "',\n\t\t\t\t\t//parametres avances\n\t\t\t\t\tslideMargin: \t\t\t'" . $this->parameters['slide_margin'] . "',\n\t\t\t\t\trandomStart: \t\t\t" . ($this->parameters['randomStart'] ? "true" : "false") . ",\n\t\t\t\t\teasing: \t\t\t\t'" . $this->parameters["easing"] . "',\n\t\t\t\t\tcaptions: \t\t\t\t" . ($this->parameters['captions'] ? "true" : "false") . ",\n\t\t\t\t\tadaptiveHeight:\t\t\t" . ($this->parameters['adaptive_heigt'] ? "true" : "false") . ",\n\t\t\t\t\tadaptiveHeightSpeed:\t'" . $this->parameters["adaptive_heigt_speed"] . "',\n\t\t\t\t\tpagerType:\t\t\t\t'" . $this->parameters["pager_type"] . "',\n\t\t\t\t\tpagerSeparator:\t\t\t'" . $this->parameters["pager_short_separator"] . "',\n\t\t\t\t\tcontrols:\t\t\t\t" . ($this->parameters['controls'] ? "true" : "false") . ",\n\t\t\t\t\tnextText:\t\t\t\t'" . $this->parameters["next_text"] . "',\n\t\t\t\t\tpreviouText:\t\t\t'" . $this->parameters["previous_text"] . "',\n\t\t\t\t\tautoControls: \t\t\t" . ($this->parameters['auto_controls'] ? "true" : "false") . ",\n\t\t\t\t\tstartText: \t\t\t\t'" . $this->parameters["start_text"] . "',\n\t\t\t\t\tstopText: \t\t\t\t'" . $this->parameters["stop_text"] . "',\n\t\t\t\t\tautoControlsCombine: \t" . ($this->parameters['autocontrols_combine'] ? "true" : "false") . ",\n\t\t\t\t\tautoDirection: \t\t\t'" . $this->parameters["auto_direction"] . "',\n\t\t\t\t\tautoDelay: \t\t\t\t'" . $this->parameters["auto_delay"] . "',\n\t\t\t\t\tauto: \t\t\t\t\t" . ($this->parameters['autotransition'] ? "true" : "false") . "\n\t\t\t\t});\n\t\t\t});\n\t\t</script>";
}
return $html2return;
}
示例10: get_isbd
static function get_isbd($id)
{
global $dbh;
$req = "select * from authperso_authorities,authperso where id_authperso=authperso_authority_authperso_num and id_authperso_authority=" . $id;
$res = pmb_mysql_query($req, $dbh);
if ($r = pmb_mysql_fetch_object($res)) {
$p_perso = new custom_parametres_perso("authperso", "authperso", $r->authperso_authority_authperso_num);
$fields = $p_perso->get_out_values($id);
$authperso_fields = $p_perso->values;
if ($r->authperso_isbd_script) {
$index_concept = new index_concept($id, TYPE_AUTHPERSO);
$authperso_fields['index_concepts'] = $index_concept->get_data();
$isbd = H2o::parseString($r->authperso_isbd_script)->render($authperso_fields);
} else {
foreach ($authperso_fields as $field) {
$isbd .= $field[values][0][format_value] . ". ";
}
}
}
return trim(preg_replace('/\\s+/', ' ', $isbd));
}
示例11: h2o
/**
* Convenient wrapper for loading template file or string
* @param $name
* @param $options - H2o options
* @return Instance of H2o Template
*/
function h2o($name, $options = array())
{
$is_file = '/([^\\s]*?)(\\.[^.\\s]*$)/';
if (!preg_match($is_file, $name)) {
return H2o::parseString($name, $options);
}
$instance = new H2o($name, $options);
return $instance;
}
示例12: build_print_diffusion
function build_print_diffusion($expl_id, $start_diff_id)
{
global $serialcirc_circ_pdf_diffusion, $charset, $serialcirc_circ_pdf_diffusion_destinataire;
global $msg;
if (!$start_diff_id) {
foreach ($this->info_expl[$expl_id]['serialcirc_diff']->diffusion as $diff_id => $diffusion) {
$start_diff_id = $diff_id;
break;
}
}
if (!$this->info_expl[$expl_id]) {
return false;
}
$req = "UPDATE serialcirc_expl SET num_serialcirc_expl_serialcirc_diff=" . $start_diff_id . ",\n\t\tserialcirc_expl_state_circ=1,\n\t\tserialcirc_expl_start_date=CURDATE()\n\t\twhere num_serialcirc_expl_id= {$expl_id}";
pmb_mysql_query($req);
$req = "select date_format(CURDATE(), '" . $msg["format_date"] . "') as print_date";
$result = pmb_mysql_query($req);
$obj = pmb_mysql_fetch_object($result);
$print_date = $obj->print_date;
$tpl = $serialcirc_circ_pdf_diffusion;
$tpl = str_replace("!!expl_cb!!", htmlentities($this->info_expl[$expl_id]['expl_cb'], ENT_QUOTES, $charset), $tpl);
$tpl = str_replace("!!date!!", htmlentities($this->info_expl[$expl_id]['mention_date'], ENT_QUOTES, $charset), $tpl);
$tpl = str_replace("!!periodique!!", htmlentities($this->info_expl[$expl_id]['serial_title'], ENT_QUOTES, $charset), $tpl);
$tpl = str_replace("!!numero!!", htmlentities($this->info_expl[$expl_id]['numero'], ENT_QUOTES, $charset), $tpl);
$tpl = str_replace("!!print_date!!", htmlentities($print_date, ENT_QUOTES, $charset), $tpl);
// $tpl=str_replace("!!abonnement!!", htmlentities($this->info_expl[$expl_id]['serialcirc_diff']->abt_name,ENT_QUOTES,$charset), $tpl);
if ($start_diff_id) {
$found = 0;
} else {
$found = 1;
}
foreach ($this->info_expl[$expl_id]['serialcirc_diff']->diffusion as $diff_id => $diffusion) {
if ($start_diff_id && !$found) {
if ($start_diff_id == $diff_id) {
$found = 1;
}
}
if ($found) {
$diff_list[] = $diff_id;
if ($diffusion["empr_type"] == SERIALCIRC_EMPR_TYPE_group) {
$name = $diffusion["empr_name"];
foreach ($diffusion['group'] as $empr_group) {
$empr_list[$empr_group["num_empr"]] = $diff_id;
if ($empr_group["duration"]) {
$empr_days[$empr_group["num_empr"]] = $empr_group["duration"];
} else {
$empr_days[$empr_group["num_empr"]] = $this->info_expl[$expl_id]['serialcirc_diff']->duration;
}
if ($diffusion['type_diff'] == 1 && !$empr_group["responsable"]) {
// groupe marguerite: on n'imprimera pas ce lecteur sauf le responsable
//$empr_no_display[$empr_group["num_empr"]]=1;
}
}
} else {
$name = $this->info_expl[$expl_id]['serialcirc_diff']->empr_info[$diffusion["num_empr"]]["empr_libelle"];
$empr_list[$diffusion["num_empr"]] = $diff_id;
if ($diffusion["duration"]) {
$empr_days[$diffusion["num_empr"]] = $diffusion["duration"];
} else {
$empr_days[$diffusion["num_empr"]] = $this->info_expl[$expl_id]['serialcirc_diff']->duration;
}
}
if ($this->info_expl[$expl_id]['serialcirc_diff']->circ_type == SERIALCIRC_TYPE_star) {
// on n'imprime que le suivant dans la liste
break;
}
}
$last_empr = $this->info_expl[$expl_id]['serialcirc_diff']->empr_info[$diffusion["num_empr"]];
}
$this->gen_circ($empr_list, $empr_days, $expl_id);
$gen_tpl = new serialcirc_print_fields($this->info_expl[$expl_id]['num_serialcirc']);
$header_list = $gen_tpl->get_header_list();
$nb_col = count($header_list);
$width_col = (int) (100 / $nb_col);
foreach ($header_list as $titre) {
$th .= "<th style='width: {$width_col}%; text-align: left'>" . htmlentities($titre, ENT_QUOTES, $charset) . "</th>";
}
$tpl = str_replace("!!th!!", $th, $tpl);
$tr_list = "";
foreach ($empr_list as $empr_id => $diff_id) {
if ($empr_no_display[$empr_id]) {
continue;
}
$data['empr_id'] = $empr_id;
$data_fields = $gen_tpl->get_line($data);
$td_list = "";
foreach ($data_fields as $field) {
$td_list .= "<td style='width: {$width_col}%; text-align: left'>" . htmlentities($field, ENT_QUOTES, $charset) . "</td>";
}
$tr_list .= "<tr>" . $td_list . "</tr>";
}
$tpl = str_replace("!!table_contens!!", $tr_list, $tpl);
if ($gen_tpl->piedpage) {
$data = array();
$data['expl'] = $this->info_expl[$expl_id];
$data['last_empr'] = $last_empr;
// printr($data['expl']);
$tpl .= H2o::parseString($gen_tpl->piedpage)->render($data);
}
if ($this->info_expl[$expl_id]['serialcirc_diff']->no_ret_circ) {
//.........这里部分代码省略.........
示例13: get_datas
public function get_datas()
{
global $opac_url_base;
global $opac_show_book_pics;
global $opac_book_pics_url;
global $dbh;
//on commence par récupérer le type et le sous-type de page...
$type_page_opac = cms_module_common_datasource_typepage_opac::get_type_page();
$subtype_page_opac = cms_module_common_datasource_typepage_opac::get_subtype_page();
if ($type_page_opac && $subtype_page_opac) {
$group_metadatas = parent::get_group_metadatas();
$datas = array();
$query = $this->get_query();
if ($query) {
$post = $_POST;
$get = $_GET;
if ($post['lvl']) {
$niveau = $post['lvl'];
} elseif ($get['lvl']) {
$niveau = $get['lvl'];
} else {
$niveau = '';
}
$result = pmb_mysql_query($query, $dbh);
while ($row = pmb_mysql_fetch_object($result)) {
$datas["id"] = $row->id;
$datas["title"] = $row->title;
$datas["resume"] = $row->resume;
if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $row->logo_url)) {
$code_chiffre = pmb_preg_replace('/-|\\.| /', '', $row->code);
$url_image = $opac_book_pics_url;
$url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($row->logo_url);
if ($row->logo_url) {
$url_vign = $row->logo_url;
} else {
if ($code_chiffre) {
$url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image);
} else {
$url_vign = $opac_url_base . "images/vide.png";
}
}
}
$datas["logo_url"] = $url_vign;
$datas["link"] = $opac_url_base . "index.php?lvl=" . $niveau . "&id=" . $row->id;
$datas["type"] = $row->type;
}
}
$datas["details"] = array('type_page' => cms_module_common_datasource_typepage_opac::get_label($type_page_opac), 'subtype_page' => cms_module_common_datasource_typepage_opac::get_label($subtype_page_opac));
$datas = array_merge($datas, parent::get_datas());
foreach ($group_metadatas as $i => $metadatas) {
if (is_array($metadatas["metadatas"])) {
foreach ($metadatas["metadatas"] as $key => $value) {
try {
$group_metadatas[$i]["metadatas"][$key] = H2o::parseString($value)->render($datas);
} catch (Exception $e) {
}
}
}
}
return $group_metadatas;
}
return false;
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:63,代码来源:cms_module_metadatas_datasource_metadatas_page_opac.class.php
示例14: getEnrichment
function getEnrichment($notice_id, $source_id, $type = "", $enrich_params = array())
{
global $dbh;
$enrichment = array();
$params = $this->get_source_params($source_id);
if ($params['PARAMETERS']) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars = unserialize($params["PARAMETERS"]);
}
$fields = array();
$query = "select recid from notices_externes where num_notice = " . $notice_id;
$result = pmb_mysql_query($query, $dbh);
if ($result && pmb_mysql_num_rows($result)) {
if ($row = pmb_mysql_fetch_object($result)) {
$external_infos = explode(" ", $row->recid);
$query = "select ufield, usubfield, field_order, value from entrepot_source_" . $external_infos[1] . " where connector_id = '" . $external_infos[0] . "' and source_id = '" . $external_infos[1] . "' and ref = '" . $external_infos[2] . "'";
$result = pmb_mysql_query($query, $dbh);
if ($result && pmb_mysql_num_rows($result)) {
while ($row = pmb_mysql_fetch_object($result)) {
// Si c'est une leçon, on a affaire à un champ répétable
if ($row->ufield == 917) {
$fields[$row->ufield][$row->field_order][$row->usubfield] = $row->value;
} else {
$fields[$row->ufield][$row->usubfield] = $row->value;
}
}
}
}
}
$lessons = array();
// Titre
$lessons['title'] = $fields[200]['a'];
// Editeur
$lessons['publisher'] = $fields[210]['c'];
// Durée
$lessons['duration'] = $fields[215]['a'];
// Catégorie
$lessons['category'] = $fields[610]['a'];
// Démo
$lessons['demo'] = $fields[856]['u'];
// Vignette
$lessons['thumbnail'] = $fields[896]['a'];
// leçons
$lessons['lessons'] = array();
foreach ($fields[917] as $lesson) {
$lessons['lessons'][] = array('id' => $lesson['a'], 'title' => $lesson['b']);
}
$infos = unserialize($this->parameters);
// url de base
if ($_SESSION['user_code'] && isset($infos['privatekey'])) {
global $empr_cb, $empr_nom, $empr_prenom;
$date = date("YmdHi");
$hash = md5($empr_cb . $date . $infos['privatekey']);
$lessons['base_url'] = "http://biblio.toutapprendre.com/ws/wsUrl.aspx?iduser=" . $empr_cb . "&firstname=" . $empr_prenom . "&lastname=" . $empr_nom . "&etablissement=" . $infos['establishmentid'] . "&d=" . $date . "&hash=" . $hash . "&pkl=";
}
$enrichment[$type]['content'] = H2o::parseString(stripslashes($vars['enrichment_template']))->render(array("lessons" => $lessons));
$enrichment['source_label'] = $this->msg['toutapprendre_enrichment_source'];
return $enrichment;
}
示例15: render
/**
* Retourne l'affichage d'un concept
* @param array $datas Données
* @param string $template Nom du template à utiliser
* @return string
*/
protected static function render($datas, $template)
{
global ${$template};
return H2o::parseString(${$template})->render(array("concept" => $datas));
}