Exemple #1
0
        $database->setQuery($sql);
        $database->query();
        $tmp_ordering = $database->loadResult();
        $old_day_status_array = $the_old_day_order[$tmp_ordering - 1];
        $old_day_status_array_expl = explode(',', $old_day_status_array);
        $new_daystatus_order = $new_daystatus_order . $day_id . ',' . $old_day_status_array_expl[1] . ';';
        if (strlen($the_old_task_order[$tmp_ordering - 1]) > 0) {
            $new_taskstatus_order = $new_taskstatus_order . $the_old_task_order[$tmp_ordering - 1] . ';';
        } else {
            $new_taskstatus_order = $new_taskstatus_order . ';';
        }
    }
}
$sql = "UPDATE #__guru_programstatus \r\n\t\t\t\t\t\tSET days='" . $new_daystatus_order . "',\r\n\t\t\t\t\t\t\ttasks='" . $new_taskstatus_order . "'\r\n\t\t\t\t\t\twhere id='103'";
$database->setQuery($sql);
$database->Query();
$i = 1;
foreach ($items as $one_item) {
    //one_item looks like this ->  6-0:false:202:
    $one_item_array = explode(':', $one_item);
    if ($one_item_array[1] == 'false') {
        // saving the new order
        $day_id = $one_item_array[2];
        $sql = "UPDATE #__guru_days \r\n\t\t\t\t\t\tSET ordering='" . $i . "'\r\n\t\t\t\t\t\twhere id='" . $day_id . "'";
        $database->setQuery($sql);
        $database->Query();
        // deleting the old day-task relation
        $sql = "DELETE FROM #__guru_mediarel \r\n\t\t\t\t\t\tWHERE type='dtask' AND type_id='" . $day_id . "'";
        $database->setQuery($sql);
        $database->Query();
        $i++;