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

Source for file class.servooconf.php

Documentation is available at class.servooconf.php

  1. <?php
  2. /**    
  3.  * Logique des options du servOO
  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.servooconf.php 4006 2007-10-05 11:53:41Z malafosse $
  40.  */
  41.  
  42.  
  43. require("logic/class.useroptiongroups.php");
  44.  
  45. /**
  46.  * Classe de logique de la configuration de ServOO
  47.  * 
  48.  * @package lodel/logic
  49.  * @author Ghislain Picard
  50.  * @author Jean Lamy
  51.  * @copyright 2001-2002, Ghislain Picard, Marin Dacos
  52.  * @copyright 2003, Ghislain Picard, Marin Dacos, Luc Santeramo, Nicolas Nutten, Anne Gentil-Beccot
  53.  * @copyright 2004, Ghislain Picard, Marin Dacos, Luc Santeramo, Anne Gentil-Beccot, Bruno Cénou
  54.  * @copyright 2005, Ghislain Picard, Marin Dacos, Luc Santeramo, Gautier Poupeau, Jean Lamy, Bruno Cénou
  55.  * @copyright 2006, Marin Dacos, Luc Santeramo, Bruno Cénou, Jean Lamy, Mikaël Cixous, Sophie Malafosse
  56.  * @copyright 2007, Marin Dacos, Bruno Cénou, Sophie Malafosse, Pierre-Alain Mignot
  57.  * @licence http://www.gnu.org/copyleft/gpl.html
  58.  * @since Classe ajouté depuis la version 0.8
  59.  * @see logic.php
  60.  */
  61.  
  62.  
  63.     /** Constructor
  64.     */
  65.     function ServOOConfLogic({
  66.     }
  67.  
  68.  
  69.     /**
  70.         * list Action
  71.         */
  72.  
  73.     function listAction(&$context,&$error)
  74.     
  75.         $this->_getGroup($context);
  76.         return UserOptionGroupsLogic::listAction($context,$error);
  77.     }
  78.  
  79.     /**
  80.         * view Action
  81.         */
  82.  
  83.     function viewAction(&$context,&$error)
  84.     
  85.         $this->_getGroup($context);
  86.         return UserOptionGroupsLogic::viewAction($context,$error);
  87.     }
  88.  
  89.     /**
  90.         * add/edit Action
  91.         */
  92.  
  93.     function editAction(&$context,&$error)
  94.     
  95.         $this->_getGroup($context);
  96.         $ret=UserOptionGroupsLogic::editAction($context,$error);
  97.  
  98.         if ($ret=="_error"return $ret;
  99.  
  100.         require("servoofunc.php");
  101.         $client=new ServOO();
  102.         if ($client->error_message{
  103.             if ($context['url']$error['url']='+';
  104.             if ($context['username'])$error['username']='+';
  105.             if ($context['passwd']$error['passwd']='+';
  106.         }
  107.  
  108.         $servoover=$client->version();
  109.  
  110.         if (preg_match("/^ERROR:/i",$servoover|| $client->error_message{
  111.             $error['servoo']=$client->error_message;
  112.             return "_error";
  113.         }
  114.  
  115.         return $ret=="_ok" "edit_options" $ret;
  116.     }
  117.  
  118.  
  119.     /*---------------------------------------------------------------*/
  120.     //! Private or protected from this point
  121.     /**
  122.         * @private
  123.         */
  124.  
  125.     function _getGroup(&$context)
  126.  
  127.     {
  128.         $dao=&getDAO("optiongroups");
  129.         $vo=$dao->find("name='servoo'");
  130.         $context['id']=$vo->id;
  131.  
  132. #    if (!$context['id']) {
  133. #      // little hack... should be in the model anyway
  134. #      $db->execute(lq("INSERT INTO #_TP_optiongroups (name,title,logic,status,exportpolicy) VALUES ('servoo','Servoo','servooconf',1,1)")) or dberror();
  135. #      $context['id']=$db->Insert_ID();
  136. #
  137. #      $db->execute(lq("INSERT INTO #_TP_options (name,title,type,userrights,idgroup,status,rank) VALUES ('url','url','url',40,".$context['id'].",32,1),('username','username','tinytext',40,".$context['id'].",32,2),(3,1,'passwd','password','passwd',40,".$context['id'].",32,3)")) or dberror();
  138. #    }
  139.     }
  140.  
  141.     // begin{publicfields} automatic generation  //
  142.     function _publicfields({
  143.         return array("name"=>array("text","+"),
  144.                                     "title"=>array("text","+"),
  145.                                     "idgroup"=>array("int","+"),
  146.                                     "type"=>array("select",""),
  147.                                     "userrights"=>array("select","+"),
  148.                                     "defaultvalue"=>array("text",""),
  149.                                     "comment"=>array("longtext",""));
  150.                         }
  151.     // end{publicfields} automatic generation  //
  152.  
  153.     // begin{uniquefields} automatic generation  //
  154.  
  155.         function _uniqueFields({  return array(array("name","idgroup"),);  }
  156.     // end{uniquefields} automatic generation  //
  157.  
  158.  
  159. // class 
  160.  
  161.  
  162. /*-----------------------------------*/
  163. /* loops                             */
  164.  
  165.  
  166.  
  167.  
  168.  
  169. ?>

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