Ejemplo n.º 1
0
 public function addaction()
 {
     $c = new content();
     if ($this->input->post("id") !== FALSE) {
         $c->get_by_id($this->input->post("id"));
     } else {
         if ($this->input->post("id") === FALSE) {
             $c->user = $this->ion_auth->get_user();
             $c->user = $c->user->id;
         }
     }
     $c->parent_section = $this->input->post("parent_section");
     $c->parent_content = $this->input->post("parent_content");
     $c->title = $this->input->post("title");
     $c->cell = $this->input->post("cell");
     $c->sort = $this->input->post("sort");
     $c->path = $this->input->post("path");
     $c->type = $this->input->post("type");
     $c->subsection = $this->input->post("subsection") == FALSE ? FALSE : TRUE;
     $c->view = $this->input->post("view");
     $c->info = $this->input->post("info");
     $c->filter = $this->input->post("filter");
     // this is a workaround, cuz it makes 2 newline characters
     // and i don't know what the hell is wrong with it.
     $c->filter = str_replace("\n\n", "\n", $c->filter);
     $p = new Content($c->parent_content);
     if ($this->input->post("id") === FALSE) {
         $this->add_info(lang('system_content_added'));
     } else {
         $this->ajax = TRUE;
         $this->print_text(lang('system_content_edited'));
     }
     $c->save();
 }
Ejemplo n.º 2
0
<?php

$ci =& get_instance();
$ci->load->library('gui');
$c = new content();
if ($ci->input->post("id")) {
    $c->get_by_id($ci->input->post("id"));
}
$c->parent_section = $ci->input->post("parent_section");
$c->parent_content = $ci->input->post("parent_content");
$c->cell = $ci->input->post("cell");
$c->sort = $ci->input->post("sort");
$c->path = $ci->input->post("path");
$c->type = $ci->input->post("type");
$c->subsection = $ci->input->post("subsection") == NULL ? FALSE : TRUE;
$c->view = $ci->input->post("view");
$c->addin = $ci->input->post("addin");
$old_edit = $c->can_edit();
$c->edit = $ci->input->post("edit");
$c->del = $ci->input->post("del");
$c->info = $ci->input->post("info");
if (!$ci->input->post("id")) {
    $p = new content();
    $p->get_by_id($c->parent_content);
    $c->attach($ci->vunsy->section, $p, $c->cell, $c->sort);
}
$p = new Section();
$p->get_by_id($c->parent_section);
if ($p->can_addin() and !$ci->input->post("id") or $ci->input->post("id") and $old_edit) {
    $c->save();
    if ($ci->input->post("id")) {