芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/thefirstcookout.com/support/application/models/database/Mtestimonial.php
SetValidation(); $this->tableName="testimonial"; $this->primaryKey="id"; $this->uniqueKey=array(); $this->multiKey=array(); $this->autoIncField=array("id"); } function SetValidation(){ $this->validations=array( "id"=>array("Text"=>"Id", "Rule"=>"max_length[10]|integer"), "name"=>array("Text"=>"Name", "Rule"=>"required|max_length[255]"), "designation"=>array("Text"=>"Designation", "Rule"=>"required|max_length[255]"), "testimonial"=>array("Text"=>"Testimonial", "Rule"=>"required"), "entry_date"=>array("Text"=>"Entry Date", "Rule"=>"max_length[20]"), "status"=>array("Text"=>"Status", "Rule"=>"max_length[1]") ); } static function get_user_image_url($id,$isVersionAdd=false){ $path=self::get_user_testimonial_path($id); if(!empty($id) && file_exists($path)){ if($isVersionAdd){ $ftime=filemtime($path); return base_url("/data/testimonial/$id.jpg?v=".$ftime); }else{ return base_url("data/testimonial/$id.jpg"); } } return base_url("images/no-image.png"); } static function get_user_testimonial_path($id){ $path=FCPATH."/data/testimonial/"; if(app_make_dir($path)){ } return $path.DIRECTORY_SEPARATOR.$id.".jpg"; } static function upload_testimonial_photo($post_name,$id){ $userpath=self::get_user_testimonial_path($id); if(move_upload_file_if_ok($post_name, $userpath)){ $objthis=new self(); $objthis->load->library("SimpleImage"); $m = new SimpleImage($userpath); $m->thumbnail(100, 100, 'center'); $m->save(); return true; }else{ return false; } } public function GetPropertyRawOptions($property,$isWithSelect=false){ $returnObj=array(); switch ($property) { case "status": $returnObj=array("A"=>"Active","I"=>"Inactive"); break; default: } if($isWithSelect){ return array_merge(array(""=>"Select"),$returnObj); } return $returnObj; } public function GetPropertyOptionsColor( $property ) { $returnObj=array(); switch ($property) { case "status": $returnObj=array("A"=>"success","I"=>"danger"); break; default: } return $returnObj; } public static function getItem($name,$designation,$testimonial) { $obj=new self(); $obj->name=$name; $obj->designation=$designation; $obj->testimonial=$testimonial; return $obj; } public static function getActiveTestimonials() { if(!self::$isLoadedOnce) { $tst = new Mtestimonial(); $tst->status( 'A' ); self::$active_testimonials = $tst->SelectAll( '', 'id', 'desc' ); self::$isLoadedOnce=true; } return self::$active_testimonials; } function GetAddForm($label_col=4,$input_col=8,$mainobj=null,$except=array(),$disabled=array()){ if(!$mainobj){ $mainobj=$this; } ?>
GetPostValue("status","'A'") == "A" ? "checked" : ""?> value="A" class="" id="status" >
" class="form-control" id="name" placeholder="" data-bv-notempty="true" data-bv-notempty-message="">
" class="form-control" id="designation" placeholder="" data-bv-notempty="true" data-bv-notempty-message="">
placeholder="" data-bv-notempty="true" data-bv-notempty-message="">GetPostValue("testimonial");?></textarea>