phpDocumentor lodel-logic
[ class tree: lodel-logic ] [ index: lodel-logic ] [ all elements ]

Source for file class.types.php

Documentation is available at class.types.php

  1. <?php
  2. /**    
  3.  * Logique des types
  4.  *
  5.  * PHP versions 4 et 5
  6.  *
  7.  * LODEL - Logiciel d'Edition ELectronique.
  8.  *
  9.  * Home page: http://www.lodel.org
  10.  * E-Mail: lodel@lodel.org
  11.  *
  12.  * All Rights Reserved
  13.  *
  14.  * This program is free software; you can redistribute it and/or modify
  15.  * it under the terms of the GNU General Public License as published by
  16.  * the Free Software Foundation; either version 2 of the License, or
  17.  * (at your option) any later version.
  18.  *
  19.  * This program is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22.  * GNU General Public License for more details.
  23.  *
  24.  * You should have received a copy of the GNU General Public License
  25.  * along with this program; if not, write to the Free Software
  26.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27.  *
  28.  * @package lodel/logic
  29.  * @author Ghislain Picard
  30.  * @author Jean Lamy
  31.  * @copyright 2001-2002, Ghislain Picard, Marin Dacos
  32.  * @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
  33.  * @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
  34.  * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  35.  * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  36.  * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  37.  * @licence http://www.gnu.org/copyleft/gpl.html
  38.  * @since Fichier ajouté depuis la version 0.8
  39.  * @version CVS:$Id: class.types.php 4006 2007-10-05 11:53:41Z malafosse $
  40.  */
  41.  
  42.  
  43. /*$GLOBALS['importdocument']=array(
  44.                  0=>array("url"=>"document.php",
  45.                       "title"=>"[@COMMON.FORM]"),
  46.  
  47.                  1=>array("url"=>"oochargement.php",
  48.                       "title"=>"[@COMMON.IMPORT_FROM_SERVOO]")
  49.  
  50.                  //                 100=>array("url"=>"biblioimport.php",
  51.                  //                        "titre"=>"BibImport")
  52.                  );*/
  53.  
  54.  
  55. /**
  56.  * Classe de logique des types
  57.  * 
  58.  * @package lodel/logic
  59.  * @author Ghislain Picard
  60.  * @author Jean Lamy
  61.  * @copyright 2001-2002, Ghislain Picard, Marin Dacos
  62.  * @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
  63.  * @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
  64.  * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  65.  * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  66.  * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  67.  * @licence http://www.gnu.org/copyleft/gpl.html
  68.  * @since Classe ajouté depuis la version 0.8
  69.  * @see logic.php
  70.  */
  71. class TypesLogic extends Logic {
  72.  
  73.     /** Constructor
  74.     */
  75.     function TypesLogic({
  76.         $this->Logic("types");
  77.     }
  78.  
  79.  
  80.     /**
  81.      * Affichage d'un objet
  82.      *
  83.      * @param array &$context le contexte passé par référence
  84.      * @param array &$error le tableau des erreurs éventuelles passé par référence
  85.      */
  86.     function viewAction(&$context,&$error)
  87.  
  88.     {
  89.         if ($errorreturn;
  90.         if (!$context['id']{
  91.             // creation
  92.             $context['creationstatus']=-1;
  93.             $context['search']=1;
  94.             $context['tpledition']="edition";
  95.             $context['tplcreation']="entities";
  96.             return "_ok";
  97.         }
  98.  
  99.         return Logic::viewAction($context,$error);
  100.     }
  101.  
  102.     /**
  103.     *  Indique si un objet est protégé en suppression
  104.     *
  105.     * Cette méthode indique si un objet, identifié par son identifiant numérique et
  106.     * éventuellement son status, ne peut pas être supprimé. Dans le cas où un objet ne serait
  107.     * pas supprimable un message est retourné indiquant la cause. Sinon la méthode renvoit le
  108.     * booleen false.
  109.     *
  110.     * @param integer $id identifiant de l'objet
  111.     * @param integer $status status de l'objet
  112.     * @return false si l'objet n'est pas protégé en suppression, un message sinon
  113.     */
  114.     function isdeletelocked($id,$status=0
  115.  
  116.     {
  117.         global $db;
  118.         $count=$db->getOne(lq("SELECT count(*) FROM #_TP_entities WHERE idtype='$idAND status>-64"));
  119.         if ($db->errorno())  dberror();
  120.         if ($count==0{
  121.             return false;
  122.         else {
  123.             return sprintf(getlodeltextcontents("cannot_delete_hasentity","admin"),$count);
  124.         }
  125.         //) { $error["error_has_entities"]=$count; return "_back"; }
  126.     }
  127.  
  128.  
  129.     /**
  130.      * Changement du rang d'un objet
  131.      *
  132.      * @param array &$context le contexte passé par référence
  133.      * @param array &$error le tableau des erreurs éventuelles passé par référence
  134.      */
  135.     function changeRankAction(&$context&$error)
  136.  
  137.     {
  138.         return Logic::changeRankAction(&$context&$error'class');
  139.     }
  140.  
  141.  
  142.     /**
  143.         *
  144.         */
  145.  
  146.     function makeSelect(&$context,$var)
  147.  
  148.     {
  149.         switch($var{
  150.         case "import" :
  151.             /* foreach($GLOBALS['importdocument'] as $n=>$v) {
  152.             #echo "bla :".strpos($v['title'],"[@"); 
  153.     $arr[]=strpos($v['title'],"[@")!==false ? getlodeltextcontents($v['title']) : $v['title']; 
  154.             }*/
  155.             #    print_r($arr);
  156.             $arr[getlodeltextcontents('form','common');
  157.             $arr[getlodeltextcontents('import_from_servoo','common');
  158.             renderOptions($arr,$context['import']);
  159.             break;
  160.         case "display" :
  161.             $arr=array(""=>getlodeltextcontents("folded","admin"),
  162.             "unfolded"=>getlodeltextcontents("unfolded","admin"),
  163.             "advanced"=>getlodeltextcontents("advanced_functions","admin")
  164.                 );
  165.             renderOptions($arr,$context['display']);
  166.             break;
  167.         case "creationstatus" :
  168.             $arr=array("-8"=>getlodeltextcontents("draft","common"),
  169.             "-1"=>getlodeltextcontents("ready_for_publication","common"),
  170.             "1"=>getlodeltextcontents("published","common"),
  171.             "8"=>getlodeltextcontents("protected","common"),
  172.             "17"=>getlodeltextcontents("locked","common"));
  173.             renderOptions($arr,$context['creationstatus']);
  174.             break;
  175.         case 'gui_user_complexity' :
  176.             require_once 'commonselect.php';
  177.             makeSelectGuiUserComplexity($context['gui_user_complexity']);
  178.             break;
  179.         }
  180.     }
  181.         
  182.  
  183.     /*---------------------------------------------------------------*/
  184.     //! Private or protected from this point
  185.     /**
  186.         * @private
  187.         */
  188.  
  189.     /**
  190.     * Sauve des données dans des tables liées éventuellement
  191.     *
  192.     * Appelé par editAction pour effectuer des opérations supplémentaires de sauvegarde.
  193.     *
  194.     * @param object $vo l'objet qui a été créé
  195.     * @param array $context le contexte
  196.     */
  197.     function _saveRelatedTables($vo,$context
  198.  
  199.     {
  200.         require_once("typetypefunc.php");
  201.  
  202.         if ($context['id']{
  203.             //typetype_delete("entrytype","identitytype='".$context['id']."'");
  204.             //typetype_delete("persontype","identitytype='".$context['id']."'");
  205.             typetype_delete("entitytype","identitytype='".$context['id']."'");
  206.         }
  207.         //typetype_insert($vo->id,$context['entrytype'],"entrytype");
  208.         //typetype_insert($vo->id,$context['persontype'],"persontype");
  209.         typetype_insert($vo->id,$context['entitytype'],"entitytype2");
  210.     }
  211.  
  212.  
  213.  
  214.     function _deleteRelatedTables($id{
  215.         global $home;
  216.  
  217.         require_once("typetypefunc.php")
  218.         $criteria="(identitytype ".sql_in_array($id)." OR identitytype2 ".sql_in_array($id).")";
  219.         typetype_delete("entitytype",$criteria);
  220.     }
  221.  
  222.  
  223.  
  224.     // begin{publicfields} automatic generation  //
  225.  
  226.     /**
  227.      * Retourne la liste des champs publics
  228.      * @access private
  229.      */
  230.     function _publicfields(
  231.     {
  232.         return array('type' => array('type''+'),
  233.                                     'title' => array('text''+'),
  234.                                     'altertitle' => array('mltext'''),
  235.                                     'class' => array('class''+'),
  236.                                     'icon' => array('image'''),
  237.                                     'gui_user_complexity' => array('select''+'),
  238.                                     'tpledition' => array('tplfile'''),
  239.                                     'display' => array('select'''),
  240.                                     'tplcreation' => array('tplfile'''),
  241.                                     'import' => array('select''+'),
  242.                                     'creationstatus' => array('select''+'),
  243.                                     'search' => array('boolean''+'),
  244.                                     'oaireferenced' => array('boolean''+'),
  245.                                     'public' => array('boolean''+'),
  246.                                     'tpl' => array('tplfile'''));
  247.     }
  248.     // end{publicfields} automatic generation  //
  249.  
  250.     // begin{uniquefields} automatic generation  //
  251.  
  252.     /**
  253.      * Retourne la liste des champs uniques
  254.      * @access private
  255.      */
  256.     function _uniqueFields(
  257.     
  258.         return array(array('type''class'));
  259.     }
  260.     // end{uniquefields} automatic generation  //
  261.  
  262.  
  263. // class 
  264.  
  265.  
  266. /*-----------------------------------*/
  267. /* loops                             */
  268.  
  269.  
  270. //function loop_persontypes($context,$funcname)
  271. //{ require_once("typetypefunc.php"); 
  272. //  loop_typetable ("persontype","entitytype",$context,$funcname,$_POST['edit'] ? $context['persontype'] : -1);}
  273. //
  274. //function loop_entrytypes($context,$funcname)
  275. //{ require_once("typetypefunc.php"); 
  276. //  loop_typetable ("entrytype","entitytype",$context,$funcname,$_POST['edit'] ? $context['entrytype'] : -1);}
  277.  
  278.  
  279. function loop_entitytypes($context,$funcname)
  280. require_once("typetypefunc.php")
  281.     #loop_typetable ("entitytype2","entitytype",$context,$funcname,$_POST['edit'] ? $context['entitytype'] : -1);
  282.  
  283. loop_typetable ("entitytype2","entitytype",$context,$funcname,$context['entitytype']);
  284. }
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291. ?>

Documentation generated on Thu, 24 Jul 2008 05:08:20 +0200 by phpDocumentor 1.4.0a2