Пример #1
0
 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save($sample = FALSE)
 {
     if ($this->loaded === FALSE) {
         if ($sample) {
             $album->name = 'My Photo Album';
             $album->view = 'lightbox';
             $album->images = '[
       {
         "path": "images/sunflower.jpg",
         "caption": "a sunflower"
       },
       {
         "path": "images/sun.jpg",
         "caption": "a very cool looking sun"
       },
       {
         "path": "images/goose.jpg",
         "caption": "a goose"
       },
       {
         "path": "images/lens.jpg",
         "caption": "a techy camera lens"
       },
       {
         "path": "images/sand-castle.jpg",
         "caption": "a tall sand castle"
       }
     ]';
         }
     }
     return parent::save();
 }
Пример #2
0
 function approve($id)
 {
     if ($_POST) {
         $rs = new Tool($id);
         $rs->from_array($_POST);
         $rs->save();
     }
 }
Пример #3
0
 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save($sample = FALSE)
 {
     if ($this->loaded === FALSE) {
         if ($sample) {
             $this->body = View::factory('public_text/sample')->render();
         }
     }
     return parent::save();
 }
Пример #4
0
 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save($sample = FALSE)
 {
     if ($this->loaded === FALSE) {
         if ($sample) {
             $this->body = 'yahboi';
         }
     }
     return parent::save();
 }
Пример #5
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Tool();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Tool'])) {
         $model->attributes = $_POST['Tool'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
Пример #6
0
 public function save()
 {
     if ($this->loaded === FALSE) {
         $new_cat = ORM::factory('showroom_cat');
         $new_cat->showroom_id = $this->id;
         $new_cat->fk_site = $this->fk_site;
         $new_cat->name = 'ROOT';
         $new_cat->local_parent = 0;
         $new_cat->position = 0;
         $new_cat->save();
         $showroom->root_id = $new_cat->id;
     }
     return parent::save();
 }
Пример #7
0
 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save()
 {
     if ($this->loaded === FALSE) {
         if ($sample) {
             $new_item = ORM::factory('calendar_item');
             $new_item->fk_site = $this->fk_site;
             $new_item->calendar_id = $this->id;
             $new_item->year = date("Y");
             $new_item->month = date("m");
             $new_item->day = date("d");
             $new_item->title = 'New Website Launch!';
             $new_item->desc = "Pizza party at my house to celebrate my new website launch. Starts at 3pm, bring your buddies!";
             $new_item->save();
         }
     }
     return parent::save();
 }
Пример #8
0
 public function save($sample = FALSE)
 {
     if ($this->loaded === FALSE) {
         $this->save();
         $new_item = ORM::factory('navigation_item');
         $new_item->navigation_id = $this->id;
         $new_item->fk_site = $this->fk_site;
         $new_item->display_name = 'ROOT';
         $new_item->type = 'none';
         $new_item->data = 0;
         $new_item->local_parent = 0;
         $new_item->save();
         $this->root_id = $new_item->id;
         if ($sample) {
             $new_item->clear();
             $new_item->navigation_id = $this->id;
             $new_item->fk_site = $this->fk_site;
             $new_item->display_name = 'Sample list item';
             $new_item->type = 'none';
             $new_item->data = '';
             $new_item->local_parent = $navigation->root_id;
             $new_item->save();
             $new_item->clear();
             $new_item->navigation_id = $this->id;
             $new_item->fk_site = $this->fk_site;
             $new_item->display_name = 'Link to Home';
             $new_item->type = 'page';
             $new_item->data = 'home';
             $new_item->local_parent = $navigation->root_id;
             $new_item->save();
             $new_item->clear();
             $new_item->navigation_id = $this->id;
             $new_item->fk_site = $this->fk_site;
             $new_item->display_name = 'External Google Link';
             $new_item->type = 'url';
             $new_item->data = 'google.com';
             $new_item->local_parent = $navigation->root_id;
             $new_item->save();
             # Update left and right values
             Tree::rebuild_tree('navigation_item', $navigation->root_id, $this->fk_site, '1');
         }
     }
     return parent::save();
 }
Пример #9
0
 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save()
 {
     if ($this->loaded === FALSE) {
         if ($sample) {
             $new_post = ORM::factory('blog_post');
             $new_post->fk_site = $this->fk_site;
             $new_post->blog_id = $this->id;
             $new_post->url = 'my-first-blog-post';
             $new_post->title = 'My First Blog Post';
             $new_post->body = '<p>All sorts of interesting content...</p> And then some more content <p>Looking good!</p>';
             $new_post->created = strftime("%Y-%m-%d %H:%M:%S");
             $new_post->status = 'publish';
             $new_post->save();
             $db = Database::instance();
             $data = array('fk_site' => $this->fk_site, 'blog_post_id' => $new_post->id, 'blog_id' => $this->id, 'value' => 'general');
             $db->insert('blog_post_tags', $data);
         }
     }
     return parent::save();
 }
Пример #10
0
 /**
  * Overload saving to set the created time and to create a new token
  * when the object is saved.
  */
 public function save()
 {
     if ($this->loaded === FALSE) {
     }
     return parent::save();
 }