function updatePosition() { $positionList = $this->input->post('positionList'); $idList = $this->input->post('idList'); $o = new Experience(); for ($i = 0; $i < count($idList); $i++) { $o->where("id", $idList[$i]); $o->get(); $o->position = $positionList[$i]; $o->save(); $o->clear(); } redirect("admin/experiences/listAll/"); }
function save($object = '', $related_field = '') { if (!$this->exists()) { $o = new Experience(); $o->select_max('position'); $o->get(); if (count($o->all) != 0) { $max = $o->position + 1; $this->position = $max; } else { $this->postion = 1; } } return parent::save($object, $related_field); }
<?php require_once 'include/config.php'; /////////////////////////////////////////////////////////// // VARIABLES //$_SESSION['language_locale'] = 'ES_ES'; //$_SESSION['language_id'] = $objLang->get(array("language_locale" => $_SESSION['language_locale']), "language_id"); /////////////////////////////////////////////////////////// // Texts //$objTrad = new Traduction(); $arrText = $objTrad->get(array("language_id" => $_SESSION['language_id'])); // Experiences $objExperience = new Experience(); $arrExperience = $objExperience->get(array("language_id" => $_SESSION['language_id'])); // Projects $objProject = new Project(); $arrProject = $objProject->get(array("language_id" => $_SESSION['language_id'], "project_image_type_id" => IMAGE_TYPE_MINI)); // Util $objUtil = new Util(); ?> <!-- Header CSS + JS --> <?php include 'include/header.php'; ?> <body> <!-- Line top --> <?php