本文整理汇总了PHP中Tool::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Tool::save方法的具体用法?PHP Tool::save怎么用?PHP Tool::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::save方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* 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: approve
function approve($id)
{
if ($_POST) {
$rs = new Tool($id);
$rs->from_array($_POST);
$rs->save();
}
}
示例3: save
/**
* 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: save
/**
* 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: actionCreate
/**
* 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: save
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: save
/**
* 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: save
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: save
/**
* 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: save
/**
* 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();
}