Beispiel #1
0
		function get_categories_list( $top=0 )
		{
			require_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ;
			$mycategory = new MyCategory( $this->mydirname, 'Show' ) ;

			$ret = array() ;
			$ret[''] = '------' ;
			$result = $this->db->query( "SELECT cid, title, child FROM ".$this->cat_table." WHERE pid='0' ORDER BY cat_weight ASC" ) ;
			while( $array = $this->db->fetchArray( $result ) ) {
				foreach ( $array as $key=>$value ){
					$$key = $value;
				}
				$id =intval( $cid ) ;
				$ret[ $id ] = $this->myts->makeTboxData4Show( $title ) ;
				if( empty( $top ) ) {
					$arr = $mycategory->unserialize_my_child( $id, '', $child ) ;
					foreach ( $arr as $child ) {
						$child_id = intval( $child['cid'] ) ;
						$child['prefix'] = str_replace( ".","--", $child['prefix'] ) ;
						$ret[ $child_id ] = $child['prefix']." " . $this->myts->makeTboxData4Show( $child['title'] ) ;
					}
				}
			}
			return $ret ;
		}
Beispiel #2
0
		function get_copy_target_category( $target_dirname )
		{
			require_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ;
			$mycategory = new MyCategory( $target_dirname, 'Show' ) ;

			$category = "" ;
			$sql = "SELECT cid, title, child FROM ".$this->db->prefix( $target_dirname."_cat" )." WHERE pid='0' ORDER BY cat_weight ASC" ;

			$result = $this->db->query( $sql );
			while( list( $id, $name, $child_array ) = $this->db->fetchRow( $result ) ) {
				$cid = intval( $id );
				$category .= "<option value='$cid'>".$this->myts->makeTboxData4Show( $name )."</option>\n" ;

				$arr = $mycategory->unserialize_my_child( $cid, '', $child_array ) ;
				foreach ( $arr as $child ) {
					$child_id = intval( $child['cid'] ) ;
					$child['prefix'] = str_replace( ".","--", $child['prefix'] ) ;
					$category .= "<option value='$child_id'>".$child['prefix']."&nbsp;".$this->myts->makeTboxData4Show( $child['title'] )."</option>\n" ;
				}
			}

			return $category ;
		}