예제 #1
0
 /**
  * Overload Sprig::create() to create new version
  * entry upon creation
  */
 public function create()
 {
     Kohana::$log->add(Kohana::DEBUG, 'Executing Versioned_Sprig::create');
     parent::create();
     $revision = Sprig::factory($this->_model . '_revision');
     $revision->values(array('entry' => $this->{$this->_primary_key}, 'version' => $this->version, 'editor' => $this->editor));
     return $revision->create();
 }
예제 #2
0
파일: token.php 프로젝트: bosoy83/progtest
 public function create()
 {
     // Set hash of the user agent
     $this->user_agent = sha1(Request::$user_agent);
     // Create a new token each time the token is saved
     $this->token = $this->create_token();
     return parent::create();
 }
예제 #3
0
파일: array.php 프로젝트: azuya/Wi3
 public function create()
 {
     // first, simply create the array as usual
     parent::create();
     // check if there are already values set, and save them
     if (!empty($this->_updatedarray)) {
         $this->update();
     }
     return $this;
 }
예제 #4
0
 public function create()
 {
     // Make sure there are no twig syntax errors
     try {
         $test = Kohanut_Twig::render($this->code);
     } catch (Twig_SyntaxError $e) {
         $e->setFilename('code');
         throw new Kohanut_Exception("There was a Twig Syntax error: " . $e->getMessage());
     } catch (Exception $e) {
         throw new Kohanut_Exception("There was an error: " . $e->getMessage() . " on line " . $e->getLine());
     }
     parent::create();
 }
예제 #5
0
파일: user.php 프로젝트: bosoy83/progtest
 public function create($role_name = false)
 {
     parent::create();
     if (!empty($role_name)) {
         $role = Sprig::factory('role', array('name' => $role_name))->load();
         if ($role->loaded()) {
             $role_user = Sprig::factory('roleuser', array('user_id' => $this->id, 'role_id' => $role->id));
             $role_user->create();
             if (empty($role_user->user_id)) {
                 $this->delete();
             }
         }
     }
 }
예제 #6
0
파일: field.php 프로젝트: azuya/Wi3
 public function create()
 {
     $return = parent::create();
     // Pass the create function to the parent
     //-------------------
     // Add the related Component to the Autoloader-paths, so it can be found by Kohana
     //-------------------
     // Get component path
     $componentpath = Wi3::inst()->pathof->pagefiller("default") . "components/";
     // Loop over component-modules and add the one for this specific field
     $dir = new DirectoryIterator($componentpath);
     foreach ($dir as $file) {
         if ($file->isDir() and !$file->isDot() and $file->getFilename() == $this->type) {
             Kohana::modules(Kohana::modules() + array($file->getPathname()));
             continue;
         }
     }
     $component = $this->getComponent();
     // Send the component of this field an event notice
     $component->fieldevent("create", $this);
     return $return;
 }
예제 #7
0
파일: mptt.php 프로젝트: banks/sprig-mptt
 /**
  * Insert the object
  * 
  * Sprig_MPTT|mixed $target target node primary key value or Sprig_MPTT object. 
  * @param string $copy_left_from target object property to take new left value from
  * @param integer $left_offset offset for left value
  * @param integer $level_offset offset for level value
  * @access protected
  * @return Sprig_MPTT
  * @throws Validation_Exception
  */
 protected function insert($target, $copy_left_from, $left_offset, $level_offset)
 {
     // Insert should only work on new nodes.. if its already it the tree it needs to be moved!
     if ($this->loaded()) {
         return FALSE;
     }
     if (!$target instanceof $this) {
         $target = Sprig_MPTT::factory($this->_model, array($this->pk() => $target))->load();
         if (!$target->loaded()) {
             return FALSE;
         }
     } else {
         $target->reload();
     }
     $this->lock();
     $this->{$this->left_column} = $target->{$copy_left_from} + $left_offset;
     $this->{$this->right_column} = $this->{$this->left_column} + 1;
     $this->{$this->level_column} = $target->{$this->level_column} + $level_offset;
     $this->{$this->scope_column} = $target->{$this->scope_column};
     $this->create_space($this->{$this->left_column});
     try {
         parent::create();
     } catch (Exception $e) {
         // We had a problem creating - make sure we clean up the tree
         $this->delete_space($this->{$this->left_column});
         $this->unlock();
         throw $e;
     }
     $this->unlock();
     return $this;
 }
예제 #8
0
 public function create()
 {
     $this->_cache_content();
     parent::create();
 }
예제 #9
0
 public function create()
 {
     $this->gc();
     return parent::create();
 }
예제 #10
0
 /**
  * Overload the create method to allow for
  * nonce generation
  *
  * @return self
  * @access public
  */
 public function create()
 {
     $this->nonce = $this->create_nonce();
     return parent::create();
 }