public function add_document($infos, $get_item_render = true, $from = '')
 {
     $result = "";
     $query = "insert into cms_documents set \n\t\t\tdocument_title = '" . addslashes($infos['title']) . "',\n\t\t\tdocument_filename = '" . addslashes($infos['filename']) . "',\n\t\t\tdocument_mimetype = '" . addslashes($infos['mimetype']) . "',\n\t\t\tdocument_filesize = '" . addslashes($infos['filesize']) . "',\t\n\t\t\tdocument_vignette = '" . addslashes($infos['vignette']) . "',\t\n\t\t\tdocument_url = '" . addslashes($infos['url']) . "',\n\t\t\tdocument_path = '" . addslashes($infos['path']) . "',\n\t\t\tdocument_create_date = '" . addslashes($infos['create_date']) . "',\t\n\t\t\tdocument_num_storage = " . $infos['num_storage'] * 1 . ",\n\t\t\tdocument_type_object = 'collection',\n\t\t\tdocument_num_object = " . $this->id . "\t\n\t\t";
     if (pmb_mysql_query($query)) {
         if ($get_item_render) {
             $document = new cms_document(pmb_mysql_insert_id());
             $document->regen_vign();
             if ($from == "form") {
                 $result = $document->get_item_form(true);
             } else {
                 $result = $document->get_item_render();
             }
         } else {
             $result = true;
         }
     } else {
         $result = false;
     }
     return $result;
 }
 public function format_datas($get_children = true, $get_articles = true, $filter = true, $get_parent = false)
 {
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     $result = array('id' => $this->id, 'num_parent' => $this->num_parent, 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'descriptors' => $this->descriptors, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents), 'last_update_date' => format_date($this->last_update_date));
     if ($get_children) {
         $result['children'] = $this->get_children($filter);
     }
     if ($get_articles) {
         $result['articles'] = $this->get_articles($filter);
     }
     if ($get_parent && $result['num_parent']) {
         $cms_parent_section = new cms_section($result['num_parent']);
         $result['parent'] = $cms_parent_section->format_datas(false, false);
     }
     return $result;
 }
Example #3
0
 public static function get_format_data_structure($type, $full = true)
 {
     global $msg;
     $main_fields = array();
     $main_fields[] = array('var' => "id", 'desc' => $msg['cms_module_common_datasource_desc_id_' . $type]);
     if ($type == "section") {
         $main_fields[] = array('var' => "num_parent", 'desc' => $msg['cms_module_common_datasource_desc_num_parent']);
     } else {
         $main_fields[] = array('var' => "parent", 'desc' => $msg['cms_module_common_datasource_desc_parent'], 'children' => self::prefix_var_tree(cms_section::get_format_data_structure(false, false), "parent"));
     }
     $main_fields[] = array('var' => "title", 'desc' => $msg['cms_module_common_datasource_desc_title']);
     $main_fields[] = array('var' => "resume", 'desc' => $msg['cms_module_common_datasource_desc_resume']);
     if ($type == "article") {
         $main_fields[] = array('var' => "content", 'desc' => $msg['cms_module_common_datasource_desc_content']);
     }
     $main_fields[] = array('var' => "logo", 'children' => self::prefix_var_tree(cms_logo::get_format_data_structure(false, false), "logo"), 'desc' => $msg['cms_module_common_datasource_desc_logo']);
     $main_fields[] = array('var' => "publication_state", 'desc' => $msg['cms_module_common_datasource_desc_publication_state']);
     $main_fields[] = array('var' => "start_date", 'desc' => $msg['cms_module_common_datasource_desc_start_date']);
     $main_fields[] = array('var' => "end_date", 'desc' => $msg['cms_module_common_datasource_desc_end_date']);
     $main_fields[] = array('var' => "descriptors", 'desc' => $msg['cms_module_common_datasource_desc_descriptors'], 'children' => array(array('var' => "descriptors[i].id", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_id']), array('var' => "descriptors[i].name", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_name']), array('var' => "descriptors[i].comment", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_comment']), array('var' => "descriptors[i].lang", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_lang'])));
     $main_fields[] = array('var' => "type", 'desc' => $msg['cms_module_common_datasource_desc_type_' . $type]);
     $main_fields[] = array('var' => "fields_type", 'desc' => $msg['cms_module_common_datasource_desc_fields_type_' . $type]);
     $main_fields[] = array('var' => "create_date", 'desc' => $msg['cms_module_common_datasource_desc_create_date']);
     //pour les types de contenu
     $fields_type = array();
     $types = new cms_editorial_types($type);
     $fields_type = $types->get_format_data_structure($full);
     return array(array('var' => $msg['cms_module_common_datasource_main_fields'], "children" => $main_fields), array('var' => "nb_documents", 'desc' => $msg['cms_module_common_datasource_desc_nb_documents']), array('var' => "documents", 'desc' => $msg['cms_module_common_datasource_desc_documents'], 'children' => self::prefix_var_tree(cms_document::get_format_data_structure(), "documents[i]")), array('var' => $msg['cms_module_common_datasource_types'], 'desc' => $msg['cms_module_common_datasource_desc_types'], "children" => $fields_type));
 }
Example #4
0
 public function format_datas($get_children = true, $get_articles = true, $filter = true, $get_parent = false)
 {
     $documents = array();
     if ($this->formated_datas === null) {
         foreach ($this->documents_linked as $id_doc) {
             $document = new cms_document($id_doc);
             $documents[] = $document->format_datas();
         }
         $this->formated_datas = array('id' => $this->id, 'num_parent' => $this->num_parent, 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'descriptors' => $this->descriptors, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
     }
     $formated_datas = $this->formated_datas;
     if ($get_children) {
         if ($filter && $this->children['filter'] === null) {
             $this->children['filter'] = $this->get_children($filter);
         } else {
             if ($this->children['full'] === null) {
                 $this->children['full'] = $this->get_children($filter);
             }
         }
         if (filter) {
             $formated_datas['children'] = $this->children['filter'];
         } else {
             $formated_datas['children'] = $this->children['full'];
         }
     }
     if ($get_articles) {
         if ($filter && $this->articles['filter'] === null) {
             $this->articles['filter'] = $this->get_articles($filter);
         } else {
             if ($this->articles['full'] === null) {
                 $this->articles['full'] = $this->get_articles($filter);
             }
         }
         if (filter) {
             $formated_datas['articles'] = $this->articles['filter'];
         } else {
             $formated_datas['articles'] = $this->articles['full'];
         }
     }
     if ($get_parent && $formated_datas['num_parent']) {
         $cms_parent_section = cms_provider::get_instance("section", $formated_datas['num_parent']);
         $formated_datas['parent'] = $cms_parent_section->format_datas(false, false);
     }
     return $formated_datas;
 }
 public function format_datas()
 {
     if ($this->formated_datas === null) {
         $this->formated_datas = array();
         $parent = cms_provider::get_instance("section", $this->num_parent);
         $documents = array();
         foreach ($this->documents_linked as $id_doc) {
             $document = new cms_document($id_doc);
             $documents[] = $document->format_datas();
         }
         $this->formated_datas = array('id' => $this->id, 'parent' => $parent->format_datas(false, false), 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => format_date($this->start_date), 'end_date' => format_date($this->end_date), 'descriptors' => $this->descriptors, 'content' => $this->contenu, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents), 'last_update_date' => format_date($this->last_update_date));
     }
     return $this->formated_datas;
 }
Example #6
0
 public function format_datas($get_children = true, $get_articles = true, $filter = true)
 {
     if ($this->logo->data) {
         $logo_exists = true;
     } else {
         $logo_exists = false;
     }
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     $result = array('id' => $this->id, 'num_parent' => $this->num_parent, 'title' => $this->title, 'resume' => $this->resume, 'logo' => array('small_vign' => $this->logo->get_vign_url("small_vign"), 'vign' => $this->logo->get_vign_url("vign"), 'large' => $this->logo->get_vign_url("large"), 'exists' => $logo_exists), 'publication_state' => $this->publication_state, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'descriptors' => $this->descriptors, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
     if ($get_children) {
         $result['children'] = $this->get_children($filter);
     }
     if ($get_articles) {
         $result['articles'] = $this->get_articles($filter);
     }
     return $result;
 }
 public function get_format_data_structure()
 {
     return array(array('var' => "documents", 'desc' => $this->msg['cms_module_common_datasource_portfolio_documents'], 'children' => $this->prefix_var_tree(cms_document::get_format_data_structure(), "documents[i]")), array('var' => "nb_documents", 'desc' => $this->msg['cms_module_common_datasource_portfolio_nb_documents']), array('var' => "type_object", 'desc' => $this->msg['cms_module_common_datasource_portfolio_type_object']), array('var' => "num_object", 'desc' => $this->msg['cms_module_common_datasource_portfolio_num_object']));
 }
Example #8
0
<?php

// +-------------------------------------------------+
// © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: ajax_main.inc.php,v 1.3 2013-07-04 12:55:50 arenou Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/autoloader.class.php";
$autoloader = new autoloader();
$autoloader->add_register("cms_modules", true);
switch ($categ) {
    case "document":
        $doc = new cms_document($id);
        switch ($action) {
            case "thumbnail":
                $doc->render_thumbnail();
                break;
            case "render":
                $doc->render_doc();
                break;
        }
        break;
    case "module":
        switch ($action) {
            case "ajax":
                $element = new $elem($id);
                $response = $element->execute_ajax();
                ajax_http_send_response($response['content'], $response['content-type']);
                break;
Example #9
0
<?php

// +-------------------------------------------------+
// © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: main.inc.php,v 1.3 2014-11-18 14:24:22 arenou Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/cms/cms_document.class.php";
$id += 0;
$document = new cms_document($id);
switch ($action) {
    case "get_form":
        $action = "./ajax.php?module=cms&categ=documents&action=save_form&id=";
        if ($caller == "editorial_form") {
            $action = "./ajax.php?module=cms&categ=documents&caller=editorial_form&action=save_form&id=";
        }
        $response['content'] = $document->get_form($action);
        break;
    case "save_form":
        $response['content'] = $document->save_form($caller);
        break;
    case "delete":
        $response['content'] = $document->delete();
        break;
    case "delete_use":
        $response['content'] = $document->delete_use();
        break;
    case "thumbnail":
        $document->render_thumbnail();
Example #10
0
 public function format_datas()
 {
     if ($this->logo->data) {
         $logo_exists = true;
     } else {
         $logo_exists = false;
     }
     $parent = new cms_section($this->num_parent);
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     return array('id' => $this->id, 'parent' => $parent->format_datas(false, false), 'title' => $this->title, 'resume' => $this->resume, 'logo' => array('small_vign' => $this->logo->get_vign_url("small_vign"), 'vign' => $this->logo->get_vign_url("vign"), 'large' => $this->logo->get_vign_url("large"), 'exists' => $logo_exists), 'publication_state' => $this->publication_state, 'start_date' => format_date($this->start_date), 'end_date' => format_date($this->end_date), 'descriptors' => $this->descriptors, 'content' => $this->contenu, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
 }
 function getCurrentDoc()
 {
     $this->currentDoc = "";
     //on peut récup déjà un certain nombre d'infos...
     $this->currentDoc["id"] = $this->listeDocs[$this->current];
     $document = new cms_document($this->currentDoc["id"]);
     $this->currentDoc["titre"] = $document->title ? $document->title : $document->filename;
     $this->currentDoc["searchterms"] = $this->params["user_query"];
     $this->currentDoc["mimetype"] = $document->mimetype;
     //pour le moment, on s'emmerde pas aevc l'article...
     $this->currentDoc["desc"] = "";
     $this->currentDoc["path"] = $document->get_document_in_tmp();
     $this->currentDoc['extension'] = $ext = substr($document->filename, strrpos($document->filename, '.') * 1 + 1);
     return $this->currentDoc;
     $this->params["explnum_id"] = $this->listeDocs[$this->current]->explnum_id;
 }
Example #12
0
 public function format_datas()
 {
     $parent = new cms_section($this->num_parent);
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     return array('id' => $this->id, 'parent' => $parent->format_datas(false, false), 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => format_date($this->start_date), 'end_date' => format_date($this->end_date), 'descriptors' => $this->descriptors, 'content' => $this->contenu, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
 }