phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] old/wcm/inc/class.bopage.inc.php, 1.1


From: nomail
Subject: [Phpgroupware-cvs] old/wcm/inc/class.bopage.inc.php, 1.1
Date: Thu, 30 Dec 2004 09:13:57 +0100

Update of /old/wcm/inc
Added Files:
        Branch: 
          class.bopage.inc.php

date: 2004/12/30 08:13:57;  author: skwashd;  state: Exp;

Log Message:
keep historic record for wcm
=====================================================================
<?php
  /**************************************************************************\
  * phpGroupWare - WCM                                                       *
  * http://www.phpgroupware.org                                              *
  * Written by Miles Lott <address@hidden>                         *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

  /* $Id: class.bopage.inc.php,v 1.1 2004/12/30 08:13:57 skwashd Exp $ */

        class bopage
        {
                var $public_functions = array(
                        'list_pages' => True,
                        'read'         => True,
                        'edit'         => True,
                        'delete'       => True
                );

                var $xml_functions  = array();
                var $soap_functions = array();

                var $debug = False;

                var $so    = '';
                var $start = 0;
                var $limit = 0;
                var $query = '';
                var $sort  = '';
                var $order = '';
                var $total = 0;

                var $use_session = False;

                var $security_types = array(
                        'standard' => '',
                        'ssl'      => 'ssl'
                );

                function bopage($session=False)
                {
                        $this->so = CreateObject('wcm.sopage');

                        if($session)
                        {
                                $this->read_sessiondata();
                                $this->use_session = True;
                        }

                        $start = get_var('start', array('POST','GET'));
                        $query = get_var('query', array('POST','GET'));
                        $sort  = get_var('sort',  array('POST','GET'));
                        $order = get_var('order', array('POST','GET'));

                        $this->start = (!empty($start) || ($start == '0')) ? 
$start : $this->start;
                        $this->query = (empty($query) && !empty($this->query)) 
|| !empty($query) ? $query : $this->query;
                }

                function save_sessiondata($data)
                {
                        if ($this->use_session)
                        {
                                if($this->debug) { echo '<br>Save:'; 
_debug_array($data); }
                                
$GLOBALS['phpgw']->session->appsession('session_data','wcm_pages',$data);
                        }
                }

                function read_sessiondata()
                {
                        $data = 
$GLOBALS['phpgw']->session->appsession('session_data','wcm_pages');
                        if($this->debug) { echo '<br>Read:'; 
_debug_array($data); }

                        $this->start  = $data['start'];
                        $this->limit  = $data['limit'];
                        $this->query  = $data['query'];
                        $this->sort   = $data['sort'];
                        $this->order  = $data['order'];
                }

                function list_pages($simple=False)
                {
                        return 
$this->so->list_pages(array($this->start,$this->sort,$this->order,$this->query,$this->limit,$simple),$this->total);
                }

                function read($id,$full=False)
                {
                        if(is_array($id))
                        {
                                $id = $id['page_id'];
                        }
                        return $this->so->read($id,$full);
                }

                function edit($page_info)
                {
                        if(!is_array($page_info))
                        {
                                return False;
                        }

                        $page_info['page_version'] = 
$this->version($page_info['page_version']);

                        if($page_info['page_id'])
                        {
                                return $this->so->update($page_info);
                        }
                        else
                        {
                                $id = $this->so->add($page_info);
                                return $this->so->read($id);
                        }
                }

                function delete($id)
                {
                        if(is_array($id))
                        {
                                $id = $id['page_id'];
                        }
                        return $this->so->delete($id);
                }

                function name2id($page_name='')
                {
                        return $this->so->name2id($page_name);
                }

                function id2name($pageid='')
                {
                        return $this->so->id2name($pageid);
                }

                function version($oldversion='',$major=False,$minor=False)
                {
                        if(!$oldversion)
                        {
                                $newversion = '0.0.1';
                        }
                        else
                        {
                                list($maj,$min,$inc) = split("\.",$oldversion);
                                $maj = intval($maj);
                                $min = intval($min);
                                $inc = intval($inc);

                                if($major)
                                {
                                        $maj++;
                                }
                                if($minor)
                                {
                                        $min++;
                                }
                                if(!($major || $minor))
                                {
                                        $inc++;
                                }

                                if($inc > 9)
                                {
                                        $inc = 0;
                                        $min++;
                                }
                                if($min > 9)
                                {
                                        $min = 0;
                                        $maj++;
                                }
                                if($maj > 9)
                                {
                                        $maj = 9;
                                }

                                $newversion = $maj . '.' . $min . '.' . $inc;
                        }
                        return $newversion;
                }
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]