Source for file PGP_CMS_MENU.phpclass

Documentation is available at PGP_CMS_MENU.phpclass

  1. <?php
  2. /**
  3.   * openCSP class file PGP_CMS_MENU.phpclass
  4.   *
  5.   * @project Open CSP-Management
  6.   * @package shop
  7.   *
  8.   * @author Peter Krebs <pitlinz@users.sourceforge.net>
  9.   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  10.   *
  11.   * @since pk-25.07.2008
  12.   * @version $Id: PGP_CMS_MENU.phpclass,v 1.7 2008/08/11 08:37:38 pitlinz Exp $
  13.   */
  14.  
  15.     // ---------------------------------------------------------
  16.     // requirements
  17.     // ---------------------------------------------------------
  18.  
  19.     pcf_require_class('CMS_MENU_NODE',"cms/menu/");
  20.     pcf_require_class('PRO_GROUP',dirname(__FILE__"/");
  21.     pcf_require_class('PGP_CMS_MENU_NODE',dirname(__FILE__"/");
  22.  
  23. /**
  24.   * openCSP class PGP_CMS_MENU
  25.   *
  26.   * @project Open CSP-Management
  27.   * @package shop
  28.   *
  29.   * @author Peter Krebs <pitlinz@users.sourceforge.net>
  30.   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  31.   *
  32.   * @since pk-25.07.2008
  33.   * @version $Id: PGP_CMS_MENU.phpclass,v 1.7 2008/08/11 08:37:38 pitlinz Exp $
  34.   */
  35. class PGP_CMS_MENU extends CMS_MENU_NODE
  36. {
  37.     // ---------------------------------------------------------------------------
  38.     // constants
  39.     // ---------------------------------------------------------------------------
  40.     
  41.     /**
  42.      * @constant string CLASS_SRC_FILE
  43.      */
  44.     const CLASS_SRC_FILE = __FILE__;
  45.  
  46.     // ---------------------------------------------------------------------------
  47.     // class (static)
  48.     // ---------------------------------------------------------------------------
  49.     
  50.     /*** class vars ------------------------------------------------------ */
  51.     
  52.     /*** class methods --------------------------------------------------- */
  53.     
  54.     
  55.     
  56.     // ---------------------------------------------------------------------------
  57.     // object vars
  58.     // ---------------------------------------------------------------------------
  59.     
  60.     /*** compostion --------------------------------------------------- */
  61.     
  62.     /**
  63.      * root product group (entry point to the pro group tree)
  64.      *
  65.      * @var PRO_GROUP 
  66.      */
  67.     protected $myRootProductGroup = Null;
  68.     
  69.     /**
  70.      * @var array $myProducts 
  71.      */
  72.     protected $myProducts = array();    
  73.     
  74.     /*** attributes  -------------------------------------------------- */
  75.     
  76.     protected $pgpRootId = 0;
  77.     
  78.     // ---------------------------------------------------------------------------
  79.     // factory / construct
  80.     // ---------------------------------------------------------------------------
  81.     
  82.     // ---------------------------------------------------------------------------
  83.     // getter / setter
  84.     // ---------------------------------------------------------------------------    
  85.  
  86.     /**
  87.       * returns a array of variables used by the menu object
  88.       *
  89.       * array[varName]=array(
  90.       *     [TYPE]          datatype
  91.       *     [FLDCLASS]      name of DBMS_FIELD* class
  92.       *     [CLASSVALS]     array of values of [FLDCLASS]
  93.       *
  94.       * @returns array
  95.       * 
  96.       * @abstract
  97.       */
  98.     protected function getObjVarDef($debug=False
  99.     {
  100.           if ($debugechoDebugMethod(__FILE__,get_class($this),"CMS_PAGE::getObjVarDef");
  101.           if (pcf_parent_method_exists($this,'getObjVarDef'))
  102.           {
  103.             $arr_ret parent::getObjVarDef();
  104.           else {
  105.               $arr_ret array();
  106.           }
  107.           
  108.         $arr_ret['PGP_ID']array(
  109.             "TYPE"      => "int",
  110.             "FLDCLASS"  => "DBMS_FIELD_PRO_PGPSELECT",
  111.             "TABLE"     => "OBJVALS_T_CMS_MENU",
  112.             "CLASSVALS" =>array(
  113.                 "label"             => t_admin("Wurzel Gruppe"),
  114.                 "allowNull"         => FALSE,
  115.                 "isSearchable"      => TRUE,
  116.                 "showInList"        => TRUE,
  117.                 "allowNullSelect"   => TRUE,
  118.                 "reloadFormOnChange"=> FALSE,
  119.                 "parentField"       => "PGP_PARENT",
  120.                 "treeROOTShowVal"   => t_admin("Wurzel"),
  121.                 "showFullTree"      => 1,
  122.                 "rootCheckOff"      => 1,
  123.                 "foreignTbl"        => "T_PRO_GROUP",
  124.                 "showField"         => "CONCAT(IFNULL(CONCAT(PGP_NUMBER,' '),''),PGP_NAME,' (',PGP_ID,')')",
  125.                 "keyField"          => "PGP_ID"                
  126.             )
  127.         );
  128.  
  129.  
  130.         $arr_ret['PGP_SHOWMENU']=array(
  131.             "TYPE"          => "int",
  132.             "FLDCLASS"      => "DBMS_FIELD_CHECKBOX",
  133.             "TABLE"         => "OBJVALS_T_CMS_MENU",
  134.             "CLASSVALS"     => array(
  135.                     "label"         => t_admin("Menüpunkt anzeigen"),
  136.                     "toolTip"       => t_admin("Produktgruppen werden an dieser Position ins Men&uuml; eingef&uuml;gt. Der Men&uuml;punkt selbst wird nicht dargestellt."),
  137.                     "showInList"    => FALSE,
  138.                     "defaultValue"  => 1,
  139.                     "defaultValue"  => 1,
  140.                     "checkedValue"  => 1,
  141.                     'checkText'        => t_admin("Ja, Menüpunkt und darunter die Produktgruppen anzeigen"),
  142.                     "lstStyle"      => 4        
  143.             )
  144.         );
  145.         
  146.         $arr_ret['PGP_URLTMPL']=array(
  147.             "TYPE"          => "string",
  148.             "FLDCLASS"      => "DBMS_FIELD",
  149.             "TABLE"         => "OBJVALS_T_CMS_MENU",
  150.             "CLASSVALS"     => array(
  151.                 "showInList"    => FALSE,
  152.                 "label"     => "Produktseite (Linktemplate)",
  153.                 "size"      => "32"
  154.             )
  155.         );
  156.  
  157.         $arr_ret['_HL_PROGROUPFILTER']=array(
  158.             "TYPE"      => "layout",
  159.             "FLDCLASS"  => "DBMS_FIELD_HEADLINE",
  160.             "CLASSVALS" =>array(            
  161.                 "colType"   => "td",
  162.                 "label"     => "Produktgruppen Filter",
  163.                 "showInList"=> FALSE
  164.             )                        
  165.         );        
  166.         
  167.         $arr_ret['PGP_CHKGETPROJ']=array(
  168.             "TYPE"              => "tinyint",
  169.             "FLDCLASS"          => "DBMS_FIELD_CHECKBOX",
  170.             "TABLE"             => "OBJVALS_T_CMS_MENU",
  171.             "CLASSVALS"         => array(
  172.                 "showInList"    => FALSE,            
  173.                 "label"         => "CMS Projekt prüfen",
  174.                 "defaultValue"  => 1,
  175.                 "checkedValue"  => 1,
  176.                 "lstStyle"      => 4
  177.             )
  178.         );
  179.  
  180.         $arr_ret['PGP_INCDEFPROJ']=array(
  181.             "TYPE"              => "tinyint",
  182.             "FLDCLASS"          => "DBMS_FIELD_CHECKBOX",
  183.             "TABLE"             => "OBJVALS_T_CMS_MENU",
  184.             "CLASSVALS"         => array(            
  185.                 "label"         => "Default Projekt",
  186.                 "defaultValue"  => 1,
  187.                 "checkedValue"  => 1,
  188.                 "checkText"     => "einschlie&szlig;en",
  189.                 "unchecckText"  => "keine Default Produkte",
  190.                 "showInList"    => FALSE
  191.             )
  192.         );
  193.         
  194.         // <pk-06-01-30>
  195.         $arr_ret['PGP_CHKSHOW']=array(
  196.             "TYPE"              => "tinyint",
  197.             "FLDCLASS"          => "DBMS_FIELD_CHECKBOX",
  198.             "TABLE"             => "OBJVALS_T_CMS_MENU",
  199.             "CLASSVALS"         => array(
  200.                 "showInList"    => FALSE,           
  201.                 "label"         => "Hackerl \"Anzeigen\"",
  202.                 "defaultValue"  => 1,
  203.                 "checkedValue"  => 1,
  204.                 "checkText"     => "pr&uuml;fen",
  205.                 "unchecckText"  => "nicht pr&uuml;fen"
  206.             )
  207.         );
  208.  
  209.         $arr_ret['PGP_CHKDATE']=array(
  210.             "TYPE"              => "tinyint",
  211.             "FLDCLASS"          => "DBMS_FIELD_CHECKBOX",
  212.             "TABLE"             => "OBJVALS_T_CMS_MENU",
  213.             "CLASSVALS"         => array(
  214.                 "showInList"    => FALSE,            
  215.                 "label"         => "Anzeigedatum",
  216.                 "defaultValue"  => 1,
  217.                 "checkedValue"  => 1,
  218.                 "checkText"     => "pr&uuml;fen",
  219.                 "unchecckText"  => "nicht pr&uuml;fen"
  220.             )
  221.         );
  222.         
  223.         $arr_ret['PGP_FILTER']=array(
  224.             "TYPE"          => "string",
  225.             "FLDCLASS"      => "DBMS_FIELD",
  226.             "TABLE"         => "OBJVALS_T_CMS_MENU",
  227.             "CLASSVALS"     => array(
  228.                 "showInList"    => FALSE,            
  229.                 "label"     => "Produktgruppen Filter",
  230.                 "size"      => "32"
  231.             )
  232.         );
  233.              
  234.         $arr_ret['_HL_PRODUCTFILTER']=array(
  235.             "TYPE"      => "layout",
  236.             "FLDCLASS"  => "DBMS_FIELD_HEADLINE",
  237.             "CLASSVALS" =>array(
  238.                 "showInList"    => FALSE,            
  239.                 "colType"   => "td",
  240.                 "label"     => "Produkt Filter",
  241.                 "showInList"=> FALSE
  242.             )                        
  243.         );        
  244.  
  245.         $arr_ret['PGP_CHKPRODUCTS']=array(
  246.             "TYPE"              => "tinyint",
  247.             "FLDCLASS"          => "DBMS_FIELD_CHECKBOX",
  248.             "TABLE"             => "OBJVALS_T_CMS_MENU",
  249.             "CLASSVALS"         => array(
  250.                 "showInList"    => FALSE,
  251.                 "label"         => "Auf anzeigbare Produkte pr&uuml;fen",
  252.                 "defaultValue"  => 0,
  253.                 "checkedValue"  => 1,
  254.                 "lstStyle"      => 4
  255.             )
  256.         );
  257.  
  258.         
  259.         $arr_ret['PGP_PROFILTER']=array(
  260.             "TYPE"          => "string",
  261.             "FLDCLASS"      => "DBMS_FIELD",
  262.             "TABLE"         => "OBJVALS_T_CMS_MENU",
  263.             "CLASSVALS"     => array(
  264.                 "showInList"    => FALSE,            
  265.                 "label"     => "Produktfilter",
  266.                 "size"      => "32"
  267.             )
  268.         );
  269.         
  270.         $arr_ret['_HL_PARTSFILTER']=array(
  271.             "TYPE"      => "layout",
  272.             "FLDCLASS"  => "DBMS_FIELD_HEADLINE",
  273.             "CLASSVALS" =>array(
  274.                 "colType"   => "td",
  275.                 "label"     => "Produkt Filter",
  276.                 "showInList"=> FALSE
  277.             )                        
  278.         );        
  279.         $arr_ret['PGP_CHKPARTS']=array(
  280.             "TYPE"              => "tinyint",
  281.             "FLDCLASS"          => "DBMS_FIELD_CHECKBOX",
  282.             "TABLE"             => "OBJVALS_T_CMS_MENU",
  283.             "CLASSVALS"         => array(
  284.                 "showInList"    => FALSE,            
  285.                 "label"         => "Auf anzeigbare Artikel pr&uuml;fen",
  286.                 "defaultValue"  => 0,
  287.                 "checkedValue"  => 1,
  288.                 "lstStyle"      => 4
  289.             )
  290.         );
  291.         $arr_ret['PGP_PARFILTER']=array(
  292.             "TYPE"          => "string",
  293.             "FLDCLASS"      => "DBMS_FIELD",
  294.             "TABLE"         => "OBJVALS_T_CMS_MENU",
  295.             "CLASSVALS"     => array(
  296.                 "showInList"    => FALSE,            
  297.                 "label"     => "Artikelfilter",
  298.                 "size"      => "32"
  299.             )
  300.         );
  301.  
  302.         return $arr_ret;
  303.  
  304.     }        
  305.     
  306.     public function getProductGroupId()
  307.     {
  308.         return intval($this->pgpRootId);
  309.     }
  310.     
  311.     // ---------------------------------------------------------------------------
  312.     // child nodes
  313.     // ---------------------------------------------------------------------------    
  314.         
  315.     /**
  316.      * faktories a PGP_CMS_MENU_NODE from $aKey
  317.      *
  318.      * @param string $aKey 
  319.      * @param boolean $debug 
  320.      * 
  321.      * @return CMS_MENU_NODE 
  322.      */
  323.     public function &factoryChildNode($aKey,$debug=False)
  324.     {            
  325.         if ($debugechoDebugMethod(__FILE__,get_class($this),"PGP_CMS_MENU::factoryChildNode(" $aKey ")");
  326.  
  327.         $arr_Key explode('-',$aKey);        
  328.         if ($int_pgpId intval($arr_Key[1]))
  329.         {
  330.             if ($obj_proGrp PRO_GROUP::getInstance($int_pgpId))
  331.             {
  332.                 $obj_ret new PGP_CMS_MENU_NODE();
  333.                 $obj_ret->setMenu($this);
  334.                 $obj_ret->setProductGroup($obj_proGrp);
  335.                 
  336.                 if ($debugechoDebugLine(__FILE__,__LINE__,"Return Node: " $obj_ret->getKey(": " get_class($obj_ret));
  337.                 
  338.                 $this->myTree->addNode($obj_ret);
  339.                 return $obj_ret;                
  340.             }
  341.         else {
  342.             echoDebugLine(__FILE__,__LINE__,"wrong key");
  343.         }
  344.         return $this;
  345.     }
  346.     
  347.     /**
  348.       * populates the children
  349.       *
  350.       * @param boolean $useCache 
  351.       * @param boolean $debug 
  352.       *
  353.       * @return double 
  354.       *
  355.       */
  356.     protected function populateChildren($useCache=True,$debug=False
  357.     {
  358.         if ($debugechoDebugMethod(__FILE__,get_class($this),"PGP_CMS_MENU::populateChildren()","MEN_ID: ".$this->getId().($useCache "USECACHE" ""));
  359.     
  360.         $this->getTree();
  361.         
  362.            if ($this->myChildren = $this->myTree->getChildNodes($this->getKey(),$debug))
  363.            {
  364.                return $this->myChildren;
  365.            }
  366.            $this->myChildren = array();
  367.  
  368.            $this->getProductGroup($debug);
  369.            
  370.            if ($arr_proGroups $this->myRootProductGroup->getChildren($debug))
  371.            {
  372.                foreach($arr_proGroups as &$obj_proGrp)
  373.                {
  374.                  $int_sort $obj_proGrp->getOrderNr();
  375.                 while(isset($this->myChildren[$int_sort])) $int_sort++;
  376.                 $this->myChildren[$int_sortnew PGP_CMS_MENU_NODE();
  377.                 $this->myChildren[$int_sort]->setOrderNr($int_sort);
  378.                 $this->myChildren[$int_sort]->setMenu($this);
  379.                 $this->myChildren[$int_sort]->setProductGroup($obj_proGrp);
  380.                 $this->myChildren[$int_sort]->setParentObj($this);                  
  381.                }
  382.            }
  383.  
  384.            $this->childrenPopulateTS time();
  385.     }
  386.     
  387.     // -------------------------------------------------------------
  388.     // check show methods
  389.     // -------------------------------------------------------------
  390.     
  391.     /**
  392.       * returns if the object is to echo in the tree when creating the html-code
  393.       * or only children are to show instead of the node
  394.       *
  395.       * @param boolean $debug 
  396.       *
  397.       * @return boolean (TRUE)
  398.       *
  399.       * @since pk-08-08-09
  400.       *
  401.       */
  402.     function isToEcho($debug=False{
  403.         if ($debugechoDebugMethod(__FILE__,get_class($this),"PGP_CMS_MENU::isToEcho()");
  404.         
  405.         return (intval($this->getDBField('PGP_SHOWMENU')) True False)
  406.     }
  407.     
  408.     
  409.     // ---------------------------------------------------------------------------
  410.     // product
  411.     // ---------------------------------------------------------------------------    
  412.     
  413.     /**
  414.      * returns the root product group
  415.      *
  416.      * @param boolean $debug 
  417.      * 
  418.      * @return PRO_GROUP 
  419.      */
  420.     public function &getProductGroup($debug=False)
  421.     {
  422.         if ($debugechoDebugMethod(__FILE__,__LINE__,"PGP_CMS_MENU::getProductGroup()");
  423.         if (pcf_is_instance_of($this->myRootProductGroup,'PRO_GROUP'))
  424.         {
  425.             return $this->myRootProductGroup;
  426.         else if (intval($this->pgpRootId)) {
  427.             $this->myRootProductGroup = PRO_GROUP::getInstance($intval($this->pgpRootId));
  428.             return $this->myRootProductGroup;
  429.         else {
  430.             $this->myRootProductGroup = new PRO_GROUP();
  431.             return $this->myRootProductGroup;
  432.         }        
  433.     }
  434.     
  435.    /**
  436.      * returns an array with the products in this menu
  437.      *
  438.      * @param boolean $debug 
  439.      * 
  440.      * @return array of PRO_PRODUCT
  441.      */
  442.     public function getProducts($directAssigned=False,$debug=False)
  443.     {
  444.         
  445.         return array();        
  446.     }
  447.     
  448. }
  449.  
  450. ?>

Documentation generated on Thu, 08 Jan 2009 17:47:52 +0100 by phpDocumentor 1.4.0a2