[PC-BSD Commits] r3144 - in websites/pbidir.com/bibivu: bin tpl tpl/pbidir

svn at pcbsd.org svn at pcbsd.org
Sat Dec 27 16:25:41 PST 2008


Author: fabry
Date: 2008-12-27 16:25:41 -0800 (Sat, 27 Dec 2008)
New Revision: 3144

Added:
   websites/pbidir.com/bibivu/tpl/api/
Modified:
   websites/pbidir.com/bibivu/bin/pbi_api.php
   websites/pbidir.com/bibivu/tpl/pbidir/xml.php
Log:
new functionality for future system update

Modified: websites/pbidir.com/bibivu/bin/pbi_api.php
===================================================================
--- websites/pbidir.com/bibivu/bin/pbi_api.php	2008-12-26 18:13:40 UTC (rev 3143)
+++ websites/pbidir.com/bibivu/bin/pbi_api.php	2008-12-28 00:25:41 UTC (rev 3144)
@@ -10,7 +10,104 @@
 	 */ 
 	public function __construct(){
 		parent::__construct();
-		session_start();
+		$task = $this->uri->get(TASK_KEY, '');
+		if(method_exists($this,'web_'.$task) && is_callable(array($this,'web_'.$task))){
+			$this->display->assign('task',$task);
+			$this->{'web_'.$task}();
+		}
 	}
+
+	public function display($page='list'){
+		$this->display->start(true,'api');
+		$this->display->show('api/'.$page);
+		$this->display->end(true,'api');
+	}
+	
+	public function web_list_categories(){
+		$search = trim($this->uri->get('search'));
+		$filters = array();
+		if($search!=''){
+			$filters[] = array('field'=>'name', 'operator'=>'LIKE', 'value'=>$search);
+		}
+		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]			= array('field'=>'show_on_site', 'operator'=>'=', 'value'=>'y');
+		$group			= array();
+		$order			= array('name');
+		$limit				= '';
+		$categories		=  load_library('category')->get_all($filters, $order, $group, $limit);
+		$this->display->assign('list',$categories);
+		$this->display->assign('type','categories');
+		$this->display('list');
+	}
+	
+	public function web_list_pbi(){
+		$search		= trim($this->uri->get('search'));
+		$category	= trim($this->uri->get('category'));
+
+		$filters = array();
+		if($search!=''){
+			$filters[] = array('field'=>'name', 'operator'=>'LIKE', 'value'=>$search);
+		}
+		if($category>0 && is_numeric($category)){
+			$filters[] = array('field'=>'category_id', 'operator'=>'=', 'value'=>$category);
+		}
+		$filters[]		= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]		= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+		$group		= array();
+		$order		= array('name');
+		$limit			= '';
+		$pbis			= load_library('pbi')->get_all($filters, $order, $group, $limit);
+		$this->display->assign('list',$pbis);
+		$this->display->assign('type','pbis');
+		$this->display('list');
+	}
+
+	public function web_list_release(){
+		$pbi_id		= trim($this->uri->get('pbi'))+0;
+		$bits			= trim($this->uri->get('bits'));
+
+		$filters		= array();
+		$filters[]		= array('field'=>'pbi_id', 'operator'=>'=', 'value'=>$pbi_id);
+		$filters[]		= array('field'=>'bits', 'operator'=>'=', 'value'=>$bits);
+		
+		$group		= array();
+		$order		= array('date_last_status_id DESC');
+		$limit			= 3;
+		$releases	= load_library('pbi_release')->get_all($filters, $order, $group, $limit);
+
+		$this->display->assign('list',$releases);
+		$this->display->assign('type','releases');
+		$this->display('list');
+	}
+
+	public function web_list_mirror(){
+		$release_id		= trim($this->uri->get('release_id'));
+		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]			= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+		$filters[]			= array('field'=>'id', 'operator'=>'=', 'value'=>$release_id);
+		$pbi_release	= load_library('pbi_release')->get_record($filters)->get_info();
+
+		$filters			= array();
+		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]			= array('field'=>'current_status_id', 'operator'=>'=', 'value'=>'100');
+		$filters[]			= array('field'=>'id', 'operator'=>'=', 'value'=>$pbi_release['pbi_id']);
+		$pbi				= load_library('pbi')->get_record($filters)->get_info();
+
+		$filters			= array();
+		$filters[]			= array('field'=>'active', 'operator'=>'=', 'value'=>'y');
+		$filters[]			= array('field'=>'last_update', 'operator'=>'>', 'value'=>$pbi_release['date_last_status_id']);
+		$mirrors			= load_library('mirror')->get_all($filters, array('last_update DESC'), array(), '','mirror');
+
+		$this->display->assign('list',$mirrors);
+		$this->display->assign('type','mirrors');
+
+		$this->display->assign('list2',$pbi);
+		$this->display->assign('type2','pbi');
+
+		$this->display->assign('list3',$pbi_release);
+		$this->display->assign('type3','pbi_release');
+
+		$this->display('list');
+	}
 }
 ?>
\ No newline at end of file

Modified: websites/pbidir.com/bibivu/tpl/pbidir/xml.php
===================================================================
--- websites/pbidir.com/bibivu/tpl/pbidir/xml.php	2008-12-26 18:13:40 UTC (rev 3143)
+++ websites/pbidir.com/bibivu/tpl/pbidir/xml.php	2008-12-28 00:25:41 UTC (rev 3144)
@@ -1,14 +1,16 @@
 <?='<?'?>xml version="1.0" encoding="utf-8" <?='?>'?><?php
-function _tt_display_node($xml){
-	if(isset($xml) && is_array($xml)){
-		foreach($xml as $key=>$value){
-			echo '<'.$key.'>';
-			if(is_array($value)){
-				_tt_display_node($value);
-			} else {
-				echo htmlentities($value, ENT_COMPAT, 'UTF-8' );
+if(!function_exists('_tt_display_node')){
+	function _tt_display_node($xml){
+		if(isset($xml) && is_array($xml)){
+			foreach($xml as $key=>$value){
+				echo '<'.$key.'>';
+				if(is_array($value)){
+					_tt_display_node($value);
+				} else {
+					echo htmlentities($value, ENT_COMPAT, 'UTF-8' );
+				}
+				echo '</'.$key.'>';
 			}
-			echo '</'.$key.'>';
 		}
 	}
 }



More information about the Commits mailing list