コード例 #1
0
 public function get_format_data_structure()
 {
     $datasource_item = new cms_module_item_datasource_item();
     $datas = array(array('var' => "tags", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_tags_desc'], 'children' => array(array('var' => "tags[i].id", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_tags_id_desc']), array('var' => "tags[i].label", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_tags_label_desc']), array('var' => "tags[i].items", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_tags_items_desc'], 'children' => $this->prefix_var_tree(docwatch_item::get_format_data_structure(), "tags[i].items[j]")), array('var' => "tags[i].link", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_tag_link_desc'])), array('var' => "items", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_items_desc'], 'children' => $this->prefix_var_tree(docwatch_item::get_format_data_structure(), "items[i]"))));
     $datas[0]['children'][2]['children'][] = array('var' => "tags[i].items[j].link", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_item_link_desc']);
     $datas[0]['children'][2]['children'][11]['children'][] = array('var' => "tags[i].items[j].tags[i].link", 'desc' => $this->msg['cms_module_itemslist_view_django_by_tags_tag_link_desc']);
     $format_datas = array_merge($datas, parent::get_format_data_structure());
     return $format_datas;
 }
 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)) {
             $itemslist = array();
             $query = "select id_item from docwatch_items where id_item 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_item = new docwatch_item($row->id_item);
                         $itemslist[] = $docwatch_item->get_normalized_item();
                     }
                 }
             }
             if ($this->parameters["nb_max_elements"] > 0) {
                 $itemslist = array_slice($itemslist, 0, $this->parameters["nb_max_elements"]);
             }
             return array('items' => $itemslist);
         }
     }
     return false;
 }
コード例 #3
0
                     $return["state"] = true;
                     $return["item"] = array("id" => $item_id);
                 }
             }
             print encoding_normalize::json_encode($return);
             break;
         case "itemIndex":
             $return = array();
             $return["action"] = $action;
             $return["state"] = false;
             if ($item_id) {
                 if ($charset != 'utf-8') {
                     $data = utf8_encode($data);
                 }
                 $data = json_decode(stripslashes($data), true);
                 $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);
コード例 #4
0
 public function get_format_data_structure()
 {
     return $this->prefix_var_tree(docwatch_item::get_format_data_structure(), "item");
 }
コード例 #5
0
ファイル: docwatch_watch.class.php プロジェクト: hogsim/PMB
 public static function get_format_data_structure()
 {
     global $msg;
     $datas = array(array('var' => "id", 'desc' => $msg['cms_module_watch_datasource_desc_id']), array('var' => "title", 'desc' => $msg['cms_module_watch_datasource_desc_title']), array('var' => "desc", 'desc' => $msg['cms_module_watch_datasource_desc_desc']), array('var' => "logo_url", 'desc' => $msg['cms_module_watch_datasource_desc_logo_url']), array('var' => "last_date", 'desc' => $msg['cms_module_watch_datasource_desc_last_date']), array('var' => "rss_link", 'desc' => $msg['cms_module_watch_datasource_desc_rss_link']), array('var' => "category", 'desc' => $msg['cms_module_watch_datasource_desc_category'], 'children' => array(array('var' => "category.id", 'desc' => $msg['cms_module_watch_datasource_desc_category_id']), array('var' => "category.title", 'desc' => $msg['cms_module_watch_datasource_desc_category_title']))), array('var' => "items", 'desc' => $msg['cms_module_watch_datasource_desc_items'], 'children' => docwatch_root::prefix_var_tree(docwatch_item::get_format_data_structure(), "items[i]")));
     return $datas;
 }
コード例 #6
0
 public function get_new_items($watch_owner)
 {
     global $dbh;
     $selector_object = $this->get_selected_selector();
     if ($selector_object) {
         $selector_values = $selector_object->get_value();
         $selector_values = $this->filter_datas($selector_values, $watch_owner);
         $items_datas = $this->get_items_datas($selector_values);
         $datasource_items = $this->fetch_datasource_items();
         for ($i = 0; $i < count($items_datas); $i++) {
             $item = new docwatch_item();
             if ($this->default_interesting) {
                 $item->set_interesting(1);
             }
             $item->set_type($items_datas[$i]['type']);
             if ($this->clean_html) {
                 $item->set_title(strip_tags($items_datas[$i]['title']));
                 $item->set_summary(strip_tags($items_datas[$i]['summary']));
                 $item->set_content(strip_tags($items_datas[$i]['content']));
             } else {
                 $item->set_title($items_datas[$i]['title']);
                 $item->set_summary($items_datas[$i]['summary']);
                 $item->set_content($items_datas[$i]['content']);
             }
             $item->set_publication_date($items_datas[$i]['publication_date']);
             $item->set_url($items_datas[$i]['url']);
             $item->set_logo_url($items_datas[$i]['logo_url']);
             $item->set_num_notice($items_datas[$i]['num_notice']);
             $item->set_source_id($this->id);
             $item->set_num_watch($this->num_watch);
             $item->set_num_article($items_datas[$i]['num_article']);
             $item->set_num_section($items_datas[$i]['num_section']);
             $item->gen_hash();
             if (!in_array($item->get_hash(), $datasource_items)) {
                 $query_hash = "select id_item from docwatch_items where item_hash = '" . $item->get_hash() . "'";
                 $resultat = pmb_mysql_query($query_hash, $dbh);
                 if (!pmb_mysql_num_rows($resultat)) {
                     $item->save();
                 }
             } else {
                 $key = array_search($item->get_hash(), $datasource_items);
                 unset($datasource_items[$key]);
             }
         }
         //Il y'a des items a supprimer de la table (ils ne sont plus dans le flux)
         if (count($datasource_items)) {
             foreach ($datasource_items as $key => $value) {
                 $item = new docwatch_item($key);
                 //On peut supprimer directement
                 if ($item->get_status > 1) {
                     $item->delete();
                 } else {
                     //Check le ttl
                     $query = "select docwatch_items.id_item from docwatch_items join docwatch_watches on docwatch_watches.id_watch=" . $this->num_watch . " where id_item = '" . $item->get_id() . "' and date_add(docwatch_items.item_added_date, interval docwatch_watches.watch_ttl hour) < now()";
                     $result = pmb_mysql_query($query, $dbh);
                     if ($result) {
                         $item->delete();
                     }
                 }
             }
         }
     }
 }
コード例 #7
0
 /**
  * 
  *
  * @return bool
  * @access public
  */
 public function del_outdated()
 {
     global $dbh;
     $query = "select id_item from docwatch_items where date_add(item_added_date, INTERVAL " . $this->ttl . " hour) < now() and item_num_watch = '" . $this->id . "'";
     $result = pmb_mysql_query($query, $dbh);
     if (pmb_mysql_num_rows($result)) {
         while ($row = pmb_mysql_fetch_object($result)) {
             $item = new docwatch_item($row->id_item);
             $item->mark_as_deleted();
         }
         return true;
     }
     return false;
 }
コード例 #8
0
<?php

// +-------------------------------------------------+
// © 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>