day, $out = preg_replace("/\bd\b/",(int)$day,$out); //m--> month (numeric: 1 to 12) $out = preg_replace("/\bm\b/",$month,$out); //M--> month text $out = preg_replace("/\bM\b/",months::text((int)$month),$out); //M3--> month text (first 3 characters) $out = preg_replace("/\bM3\b/",substr(months::text((int)$month),0,3),$out); //y o Y --> Year complete (2006, 2007, etc) $out = preg_replace("/\b[yY]\b/",$year,$out); //y2 o Y2 --> Year short (06,07 etc) $out = preg_replace("/\b[yY]2\b/",substr($year,-2),$out); return $out; }//end function format function today($str_format=CLASS_DATE_DEFAULT_FORMAT) { echo date::format(date("Y-n-j"),$str_format); } function weekday($date) { return(date::weekdays(msv("SELECT DAYOFWEEK('$date')"))); } function weekdays($day_number) { switch($day_number) { case 1: return "Domingo"; case 2: return "Lunes"; case 3: return "Martes"; case 4: return "Miércoles"; case 5: return "Jueves"; case 6: return "Viernes"; case 7: return "Sábado"; } } function months($month) { return months::text($month); } }//end class date ?>nrows()) return; $out=""; $rs->reset(); if($width) $td_tag_width=" width='".floor(100/$width)."%'"; unset($arr_checked); if(is_array($param1['arr_checked'])) $arr_checked=$param1['arr_checked']; elseif($param1['sql_checked']) $arr_checked=msc($param1['sql_checked']); elseif($param1['set_checked']) $arr_checked=explode(",",$param1['set_checked']); $columnas_impresas=0; while($rs->next()) { if($columnas_impresas==$width) { $out.=""; $columnas_impresas=0; } $out.=""; $columnas_impresas++; }//end while $out.="
id(),$arr_checked) ) $out.= " checked"; $out.=">"; if($img) $out.='  '; $out.="
"; return $out; }//end cb_table //Trae el pulldown con los valores de una tabla id nombre function pd($name,$sql,$value,$optional=true){ $out= ""; return $out; }//end pd_lookup function pd_lookup($name,$table,$value,$optional=true) { return tools::pd($name,"SELECT id, nombre FROM $table ORDER BY nombre",$value,$optional); } function cb_div($param1,$param2=NULL,$width=NULL,$width_col=NULL){ if(is_array($param1)) { $name =$param1['name']; $id_prefix =$param1['id_prefix']; $rs =$param1['rs']; $width =$param1['width']; $width_col =$param1['width_col']; $extra_tag =$param1['extra_tag']; $img =$param1['img']; } else { $name=$param2; $rs=$param2; } if(!$width) $width=1; if(!$id_prefix) $id_prefix=$name; if(!$rs) return false; if(!$rs->nrows()) return; $out="
"; $rs->reset(); if ($width_col) { $td_tag_width=" width:".$width_col."px;"; } /* else { $td_tag_width=" width='".floor(100/$width)."%'"; } */ unset($arr_checked); if(is_array($param1['arr_checked'])) $arr_checked=$param1['arr_checked']; elseif($param1['sql_checked']) $arr_checked=msc($param1['sql_checked']); elseif($param1['set_checked']) $arr_checked=explode(",",$param1['set_checked']); $columnas_impresas=0; while($rs->next()) { if($columnas_impresas==$width) { //$out.=""; $columnas_impresas=0; } $out.="
id(),$arr_checked) ) $out.= " checked"; $out.=">"; if($img) $out.='  '; $out.="
"; $columnas_impresas++; }//end while $out.="
"; return $out; }//end cb_div }//end class ?>res=msq($q); } }//end constructor function next(){ if(isset($this->res)) if($this->row=mysql_fetch_array($this->res)) { $this->current++; return true; } else return false; }//end function next function nrows(){ return @mysql_num_rows($this->res); } function pages(){ if(!isset($this->pages)) $this->pages=ceil($this->nrows()/$this->page_size); return $this->pages; } function reset(){ unset($this->row); return @mysql_data_seek($this->res,0); } function current(){ return $this->current; } function moveto($pos){ $this->reset(); for($i=0;$i<$pos;$i++) $this->next(); }//end moveto //Handy function which brings the value of the field $field, //from the row which meets the conditions specified as a query string function find($field, $qs_where) { $arr_eq=explode("&",$qs_where); $original_pos=$this->current(); foreach($arr_eq as $eq) { list($key,$value)=explode("=",$eq); $arr_kv[$key]=$value; } $this->reset(); while($this->next()) { $found=true; foreach($arr_kv as $key=>$value) { if($this->row[$key]!=$value) $found=false; }//end foreach $arr_kv if($found) { $ret=$this->row[$field]; $this->moveto($original_pos); return $ret; } }//end while $this->moveto($original_pos); return false; }//end find(); /////////////////////////// // PAGING /////////////////////////// function paging($param=NULL){ $wing=4; //how many numbers a the side of the shown page display $shown; //shown page (pag) $pp; //printed page - current: page inside the paging loop $pp_last; //printed page number (last) $page_size =$param['page_size']; $sep =$param['sep']; //param['omit'] //no arrastrar estos valores en el query string if(!$sep) $sep=" | "; if(!$page_size) { $page_size=$this->page_size; } if(!$page_size) { trigger_error("rs::paging: No se pudo determinar page_size",E_USER_WARNING); return; } $shown=$_REQUEST['pag']; if(!$shown) $shown=1; /*if($shown<=1) { $_SESSION['SES_filtro']=$_POST; } d($_SESSION['SES_filtro']);*/ //npages $npages=ceil($this->nrows()/$page_size); //pp_first: $pp_first=($shown)-($wing); if($pp_first < 1) $pp_first=1; //pp_last: $pp_last=$shown+$wing; if($pp_last > $npages) $pp_last=$npages; ////////////// //Armar HTML ///////////// unset($out); //Imprimir "anterior": if($shown >1 and $pp_first>1) $out.="<< "; $first=true; //Imprimir numeros for($i=$pp_first; $i<= $pp_last; $i++) { if(!$first) $out.= $sep; else $first=false; if($i!=$shown) $out.= " ".$i.""; else $out.= " $i"; } //Imprimir "siguiente" if($pp_last < $npages) $out.= " >>"; return $out; }//end paging() function paging_pd(){ //PAGING----------------------- //Mostrar paging? $out= '
Día: 
Mes: 
Año: 
name=$name; $this->value=$value; }//end constructor function play(){ static $function_time_update;//valvula para poner solo una vez la funcion de javascript list($h,$m,$s)=explode(":",$this->value); //solo se usa h y m if(!$function_time_update===true) { $function_time_update=true; ?>
name=$_name; $this->value=$_value; }//end constructor function play($_name=NULL,$_value=NULL) { if($_name) { $name=$_name; $this->name=$_name; } else $name=$this->name; if($_value) $value=$_value; else $value=$this->value; ?> own_descriptions) { ?>
display_thumbs($this->value,$this->own_descriptions)?>
rstring) $param['rstring']=$this->rstring; else $param['rstring']=SYSTEM_RSTRING;//use system default resize string $param['name']=$this->name; $param['ext']=$this->ext; $param['size']=$this->size; $param['max']=$this->max; $param['use_prev']=$this->use_prev; //Enable "use previous images? ("utilizar archivos subidas anteriormente") if($this->own_descriptions) { $param['own_descriptions']=1; $param['article']=$this->article; } ?>
article."' AND archivos.id=nf.foto WHERE FIND_IN_SET(archivos.id,'$set_images') GROUP BY archivos.id ORDER BY FIND_IN_SET(archivos.id,'$set_images') "); //Use name to identify controls from other possible instances of the uploader $name=$this->name; if(!$name) $name=$_GET['name']; } else $res=msq("SELECT id,archivo,descripcion FROM archivos WHERE FIND_IN_SET(id,'$set_images') ORDER BY FIND_IN_SET(id,'$set_images')"); if(mysql_num_rows($res)) { echo "" .""; if(!$own_descriptions) //single line if not "own descriptions" ""; $printed_col=0; while($row=fah($res)) { //Busco icono $icon_ext=substr($row['archivo'],-3); switch($icon_ext) { case "pdf": $icon="icon-pdf.png"; break; case "doc": $icon="icon-doc.png"; break; case "ppt": $icon="icon-ppt.png"; break; case "xls": $icon="icon-xls.png"; break; case "txt": $icon="icon-file.png"; break; default: $icon="icon-file.png"; } $f_icon="/system/uploader_files/icons/".$icon; if($own_descriptions) //multiple lines with "own descriptions" ""; ?>
 
"; $printed_col++; } if(!$own_descriptions) //single line close echo ""; echo "
'/>
"; } }//end function display_thumbs //////////////////////////////////////// // save_descriptions() //////////////////////////////////////// // // Use this function in action.php // after saving the article. It stores // the images descriptions. //////////////////////////////////////// function save_descriptions($article){ //For each field which had own descriptions, we'll process //the images specified in it. //Note that the model doesn't allow the same image to have //different descriptions among the same article $fields=$_POST['uploader_own_descriptions_fields']; if(count($fields)) foreach($fields as $field) { $images_ids=@explode(",",$_POST[$field]); //Now, for each image save an "attached" description in the table articles_images if(count($images_ids)) foreach($images_ids as $image_id) { $description=$_POST['uploader_'.$field.'_image_'.$image_id.'_description']; //Attach description only if it is not empty if($description!='') { $sql_set="SET nota=$article,foto=$image_id,descripcion='$description'"; //relationship id $id_rel=msv("SELECT id FROM notas_archivos WHERE nota=$article AND foto=$image_id"); if($id_rel) { mse("UPDATE notas_archivos $sql_set WHERE id=$id_rel"); } else { mse("INSERT INTO notas_archivos $sql_set"); $id_rel=mysql_insert_id(); } $arr_keep[]=$id_rel; } }//end foreach image in a field }//end foreach field //Delete removed by user or with empty description $set_keep=@implode(",",$arr_keep); mse("DELETE FROM notas_archivos WHERE nota=$article AND !FIND_IN_SET(id,'$set_keep')"); }//end save_descriptions() }//end class uploader ?>name=$name; $this->value=$value; }//end constructor function play(){ static $function_date_update;//valvula para poner solo una vez la funcion de javascript list($anio,$mes,$dia)=explode("-",$this->value); ?>
Día: 
Mes: 
Año: 
name=$_name; $this->value=$_value; $this->nota=$_nota; }//end constructor function play($_name=NULL,$_value=NULL) { if($_name) { $name=$_name; $this->name=$_name; } else $name=$this->name; if($_value) $value=$_value; else $value=$this->value; if($this->rstring) $rstring=$this->rstring; else $rstring=SYSTEM_RSTRING;//use system default resize string ?> */?>
display_thumbs($this->value,$this->own_descriptions); //AGREGADO POR PABLO ?>
Standard Use*/?> " value="" />
(Tipos de Archivo Permitidos: jpg,jpeg,gif,png)

display_thumbs($this->value,$name); //AGREGADO POR PABLO ?>
" .""; $printed_col=0; while($row=fah($res)) { ?>'> ".$row['archivo'].""; //Imprime Nombre de archivo ?>   "; } }//end function display_thumbs }//end class single_uploader ?>