/**
  * Fetch datas
  * 
  */
 public function fetch_datas()
 {
     global $dbh;
     if ($this->id) {
         $query = "select category_title, category_num_parent from docwatch_categories where id_category=" . $this->id;
         $result = pmb_mysql_query($query, $dbh);
         if ($row = pmb_mysql_fetch_object($result)) {
             $this->title = $row->category_title;
             $this->num_parent = $row->category_num_parent;
         }
     } else {
         $this->title = "Racine";
         $this->num_parent = -1;
     }
     $query = "select id_watch from docwatch_watches where watch_num_category=" . $this->id;
     $result = pmb_mysql_query($query, $dbh);
     while ($row = pmb_mysql_fetch_object($result)) {
         $docwatch_watch = new docwatch_watch($row->id_watch);
         //Gestion des droits utilisateurs (on affiche uniquement les veilles paramétrées pour le current user)
         if (in_array(SESSuserid, $docwatch_watch->get_allowed_users())) {
             $this->watches[] = $docwatch_watch->get_informations();
         }
     }
     $query = "select id_category from docwatch_categories where category_num_parent=" . $this->id;
     $result = pmb_mysql_query($query, $dbh);
     while ($row = pmb_mysql_fetch_object($result)) {
         $this->children[] = new docwatch_watches($row->id_category);
     }
 }
 public function get_datas()
 {
     global $dbh;
     //on commence par récupérer l'identifiant retourné par le sélecteur...
     $selector = $this->get_selected_selector();
     if ($selector) {
         $return = array();
         if (count($selector->get_value()) > 0) {
             foreach ($selector->get_value() as $value) {
                 $return[] = $value;
             }
         }
         if (count($return)) {
             $watcheslist = array();
             $query = "select id_watch from docwatch_watches where id_watch in (" . implode(",", $return) . ")";
             if ($this->parameters["sort_by"] != "") {
                 $query .= " order by " . $this->parameters["sort_by"];
                 if ($this->parameters["sort_order"] != "") {
                     $query .= " " . $this->parameters["sort_order"];
                 }
             }
             $result = pmb_mysql_query($query, $dbh);
             if ($result) {
                 if (pmb_mysql_num_rows($result)) {
                     while ($row = pmb_mysql_fetch_object($result)) {
                         $docwatch_watch = new docwatch_watch($row->id_watch);
                         $watcheslist[] = $docwatch_watch->get_normalized_watch();
                     }
                 }
             }
             if ($this->parameters["nb_max_elements"] > 0) {
                 $watcheslist = array_slice($watcheslist, 0, $this->parameters["nb_max_elements"]);
             }
             return array('watches' => $watcheslist);
         }
     }
     return false;
 }
 public function get_format_data_structure()
 {
     $datasource_watch = new cms_module_watch_datasource_watch();
     $datas = array(array('var' => "categories", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_categories_desc'], 'children' => array(array('var' => "categories[i].id", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_categories_id_desc']), array('var' => "categories[i].title", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_categories_title_desc']), array('var' => "categories[i].watches", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_categories_watches_desc'], 'children' => $this->prefix_var_tree(docwatch_watch::get_format_data_structure(), "categories[i].watches[j]")), array('var' => "categories[i].children", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_categories_children_desc'])), array('var' => "watches", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_watches_desc'], 'children' => $this->prefix_var_tree(docwatch_watch::get_format_data_structure(), "watches[i]"))));
     $datas[0]['children'][2]['children'][] = array('var' => "categories[i].watches[j].link", 'desc' => $this->msg['cms_module_watcheslist_view_django_by_categories_watch_link_desc']);
     $format_datas = array_merge($datas, parent::get_format_data_structure());
     return $format_datas;
 }
示例#4
0
 public function mark_as_deleted()
 {
     global $dbh;
     if (docwatch_watch::check_watch_rights($this->num_watch)) {
         $query = "update docwatch_items set item_status = '2' where id_item = '" . $this->id . "' ";
         if (pmb_mysql_query($query, $dbh)) {
             return true;
         } else {
             return false;
         }
     }
 }
 public function get_format_data_structure()
 {
     return $this->prefix_var_tree(docwatch_watch::get_format_data_structure(), "watch");
 }
示例#6
0
                 $docwatch_item = new docwatch_item($item_id);
                 if ($docwatch_item->index($data)) {
                     $return["state"] = true;
                     //$return["item"] = array("id" => $item_id,"descriptors_isbd" => $docwatch_item->get_descriptors_isbd(),"tags_isbd" => $docwatch_item->get_tags_isbd());
                     $return["item"] = $docwatch_item->get_normalized_item();
                 }
             }
             print encoding_normalize::json_encode($return);
             break;
     }
     break;
 case "sources":
     switch ($action) {
         case "get_sources":
             if ($watch_id) {
                 $docwatch_watch = new docwatch_watch($watch_id);
                 print encoding_normalize::json_encode($docwatch_watch->get_normalized_datasources());
             }
             break;
         case "get_form":
             if (!is_object($autoloader)) {
                 $autoloader = new autoloader();
             }
             $autoloader->add_register("docwatch", true);
             if ($id) {
                 $query = "select id_datasource,datasource_type from docwatch_datasources where id_datasource = '" . $id * 1 . "'";
                 $result = pmb_mysql_query($query, $dbh);
                 if (pmb_mysql_num_rows($result)) {
                     $row = pmb_mysql_fetch_object($result);
                     $datasource = new $row->datasource_type($row->id_datasource);
                 }
 public function sync($watch_owner)
 {
     if (docwatch_watch::check_watch_rights($this->num_watch)) {
         //TODO: utiliser le watch_owner passé en parametre pour requeter sur la base avec les bons droits
         $this->get_new_items($watch_owner);
         $this->update_last_date();
     }
 }
示例#8
0
$base_noheader = 1;
$base_nobody = 1;
//Il me faut le charset pour la suite
require_once $base_path . "/includes/init.inc.php";
require_once $base_path . "/includes/error_report.inc.php";
require_once $base_path . '/includes/opac_config.inc.php';
// récupération paramètres MySQL et connection á la base
if (file_exists($base_path . '/includes/opac_db_param.inc.php')) {
    require_once $base_path . '/includes/opac_db_param.inc.php';
} else {
    die("Fichier opac_db_param.inc.php absent / Missing file Fichier opac_db_param.inc.php");
}
require_once $base_path . "/includes/global_vars.inc.php";
require_once $base_path . '/includes/opac_mysql_connect.inc.php';
$dbh = connection_mysql();
//Sessions !! Attention, ce doit être impérativement le premier include (à cause des cookies)
require_once $base_path . "/includes/session.inc.php";
require_once $base_path . '/includes/start.inc.php';
// à inclure?
require_once $base_path . "/includes/check_session_time.inc.php";
require_once $base_path . "/includes/rec_history.inc.php";
//le kit nécessaire aux veilles...
require_once $class_path . "/autoloader.class.php";
$autoloader = new autoloader();
$autoloader->add_register("docwatch", true);
//ca suffit...
if ($id) {
    $watch = new docwatch_watch($id);
    $watch->fetch_items(true);
    print $watch->get_xmlrss();
}
示例#9
0
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: docwatch.tpl.php,v 1.22 2015-12-15 11:37:28 dgoron Exp $
if (stristr($_SERVER['REQUEST_URI'], ".tpl.php")) {
    die("no access");
}
$docwatch_tpl = "\n<script type='text/javascript' src='./javascript/ajax.js'></script>\n<script type='text/javascript'>\n\tdojo.require('dojox.layout.ContentPane');\n</script>\n<link rel='stylesheet' type='text/css' href='./javascript/dojo/dojox/grid/resources/Grid.css'>\n<link rel='stylesheet' type='text/css' href='./javascript/dojo/dojox/grid/resources/claroGrid.css'>\n\t\t\n<div data-dojo-id='availableDatasources' data-dojo-type='dojo/store/Memory' data-dojo-props='data:" . htmlentities(encoding_normalize::json_encode(docwatch_watch::get_available_datasources()), ENT_QUOTES, "utf-8") . "'>\n<div data-dojo-id='availableDatatags' data-dojo-type='dojo/store/Memory' data-dojo-props='data:" . htmlentities(encoding_normalize::json_encode(docwatch_item::get_available_datatags()), ENT_QUOTES, "utf-8") . "'>\n\n</div>\n<div data-dojo-type='dijit/layout/BorderContainer' data-dojo-props='splitter:true' style='height:800px;width:100%;'>\n\t<div data-dojo-type='apps/docwatch/WatchesUI' data-dojo-props='splitter:true,region:\"left\"' style='height:100%;width:200px;'>\n\t</div>\n\t<div data-dojo-type='dijit/layout/BorderContainer' data-dojo-props='splitter:true,region:\"center\"' style='height:100%;width:auto;'>\n\t\t<div data-dojo-type='dijit/layout/TabContainer' data-dojo-props='splitter:true,region:\"top\"' style='width:auto;height:50%'>\n\t\t\t<div data-dojo-type='apps/docwatch/ItemsListUI' title='" . $msg['dsi_docwatch_itemslistui_title'] . "'>\n\t\t\t</div>\n\t\t\t<div data-dojo-type='apps/docwatch/SourcesListUI' title='" . $msg['dsi_docwatch_sourceslistui_title'] . "'>\n\t\t\t</div>\n\t\t</div>\n\t\t<div  data-dojo-props='region:\"center\"' style='width:auto;height:50%' data-dojo-type='apps/docwatch/ItemUI'></div>\n\t\t<div  data-dojo-props='region:\"center\"' style='width:auto;display:none;height:50%;overflow:auto' data-dojo-type='apps/docwatch/SourceUI'></div>\n\t</div>\t\n</div>\n";
$docwatch_new_source_form_tpl = '
<form data-dojo-attach-point="containerNode" data-dojo-attach-event="onreset:_onReset,onsubmit:_onSubmit" ${!nameAttrSetting}>	
	<h3>' . $msg["dsi_docwatch_add_source"] . '</h3>
	<div class="form-contenu">
		<select name="selector_choice" data-dojo-type="dijit/form/Select" style="width:auto">
			<option value="0">' . $msg['dsi_'] . '</option>';
foreach (docwatch_watch::get_available_datasources() as $class => $label) {
    $docwatch_new_source_form_tpl .= '
			<option value="' . $class . '">' . $label . '</option>';
}
$docwatch_new_source_form_tpl .= '
		</select>		
	</div>
</form>';
$docwatch_watch_form_tpl = '
<div style="width: 400px; height: 500px; overflow: auto;">
<form data-dojo-attach-point="containerNode" data-dojo-attach-event="onreset:_onReset,onsubmit:_onSubmit" ${!nameAttrSetting}>	
	<div class="form-contenu">
		<input type="hidden" name="id" id="id" value=""/>
		<div class="row">
			<label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_category_form_category_parent']) . '</label>
		</div>