Ejemplo n.º 1
0
 public function getData()
 {
     $flags = flag::select(array('flags.id', 'flags.nama'));
     return Datatables::of($flags)->add_column('actions', '
         <div>
              <a href="{{{ URL::to(\'admin/flags/\' . $id . \'/edit\' ) }}}" class="btn btn-primary btn-xs iframe" ><i class="fa fa-pencil"></i></a> <a href="{{{ URL::to(\'admin/flags/\' . $id . \'/delete\' ) }}}" class="btn btn-xs btn-danger iframe"><i class="fa fa-trash-o"></i></a>
         </div>
         ')->remove_column('rn')->make();
 }
Ejemplo n.º 2
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      flag $value A flag object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(flag $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Ejemplo n.º 3
0
Archivo: db.php Proyecto: hazardland/db
 /**
  * @param \db\database $database
  * @param type $class
  */
 public function __construct($class)
 {
     $this->query = new query();
     $this->id = type($class);
     $this->table = str_replace('.', '_', substr($this->id, 1));
     if (strripos($this->id, ".") !== false) {
         $this->name = substr($class, strripos($this->id, ".") + 1);
     } else {
         $this->name = $this->id;
     }
     $input = new \stdClass();
     $this->class = new \ReflectionClass(str_replace(".", "\\", $this->id));
     $flags = flag::set($this->class);
     if (is_array($flags)) {
         foreach ($flags as &$flag) {
             if ($flag->name == 'ignore') {
                 throw new \Exception('table ignored');
             } elseif ($flag->name == 'database') {
                 $this->database = $flag->value;
             } else {
                 if ($flag->name == 'prefix') {
                     $this->prefix = $flag->value;
                 } else {
                     if ($flag->name == 'link') {
                         $this->link = $flag->value;
                     } else {
                         if ($flag->name == 'table') {
                             $this->table = $flag->value;
                         } else {
                             if ($flag->name == 'engine') {
                                 $this->engine = $flag->value;
                             } else {
                                 if ($flag->name == 'charset') {
                                     $this->charset = $flag->value;
                                 } else {
                                     if ($flag->name == 'rename') {
                                         $this->rename = $flag->value;
                                     } else {
                                         if ($flag->name == 'order') {
                                             $input->order = explode(',', $flag->value);
                                         } else {
                                             if ($flag->name == 'limit') {
                                                 debug($flag->value);
                                             } else {
                                                 if ($flag->name == 'cache') {
                                                     if ($flag->value == 'long') {
                                                         $this->cache = cache::long;
                                                     } else {
                                                         if ($flag->value == 'user') {
                                                             $this->cache = cache::user;
                                                         } else {
                                                             if ($flag->value == 'load') {
                                                                 $this->cache = cache::load;
                                                             } else {
                                                                 if ($flag->value == 'none') {
                                                                     $this->cache = cache::none;
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     if ($flag->name == 'scope') {
                                                         if ($flag->value == 'solution') {
                                                             $this->scope = scope::solution;
                                                         } else {
                                                             if ($flag->value == 'project') {
                                                                 $this->project = scope::project;
                                                             }
                                                         }
                                                     } elseif ($flag->name == 'deny') {
                                                         if ($flag->value == 'insert') {
                                                             $this->insert = false;
                                                         } else {
                                                             if ($flag->value == 'update') {
                                                                 $this->update = false;
                                                             } else {
                                                                 if ($flag->value == 'select') {
                                                                     $this->select = false;
                                                                 } else {
                                                                     if ($flag->value == 'delete') {
                                                                         $this->delete = false;
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     foreach ($this->class->getProperties() as $value) {
         /* @var $value \ReflectionProperty */
         try {
             $field = new field($this, $value);
             $this->fields[$field->name] = $field;
             if ($field->primary) {
                 $this->primary =& $this->fields[$field->name];
             }
         } catch (\Exception $fail) {
         }
         //$type = new type($value);
         //$type->
     }
     if ($this->primary == null) {
         if (isset($this->fields['id'])) {
             $this->primary =& $this->fields['id'];
             $this->primary->primary();
         }
     }
     if (is_array($input->order)) {
         if (count($input->order) == 1) {
             if (strpos($input->order[0], ':')) {
                 $input->order = explode(':', $input->order[0]);
                 if (isset($this->fields[$input->order[0]])) {
                     $this->query->order->field($input->order[0]);
                     if ($input->order[1] == 'asc' || $input->order[1] == 'desc') {
                         $this->query->order->method($input->order[1]);
                     }
                 }
                 // debug ($this->query->order);
                 // exit;
             } else {
                 if (isset($this->fields[$input->order[0]])) {
                     $this->query->order->field($input->order[0]);
                 }
             }
         } else {
             foreach ($input->order as $data) {
                 if (strpos($input->order[0], ':')) {
                     $data = explode(':', $data);
                     if (isset($this->fields[$data[0]])) {
                         $this->query->order->add($data[0], $data[1]);
                     }
                 } else {
                     if (isset($this->fields[$data])) {
                         $this->query->order->add($data);
                     }
                 }
             }
             // debug ($this->query->order);
             // debug ($this->query->order->result($this));
             // exit;
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      flag $value A flag object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(flag $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('flagPeer');
         }
     }
 }