예제 #1
0
function update($update)
{
    if (isset($update['update'])) {
        for ($i = 1; $i <= floor(count($update) / 8) + 1; $i++) {
            if (!$update['del' . $i]) {
                add_personal_date($update['Name' . $i], $update['Surname' . $i], $update['Age' . $i], $update['key' . $i]);
                $cat_id = get_id_by_name('Categories', $update['Category' . $i]);
                add_person_cat($update['key' . $i], $cat_id);
                $subjs = get_subjects();
                foreach ($subjs as $id => $name) {
                    add_person_mark($update['key' . $i], $id, $update[$i . 'subj' . $id]);
                }
            } else {
                delete_person($update['key' . $i]);
            }
        }
        echo "<p>Dates updated successfully!</p>";
    }
}
예제 #2
0
<?php

$obj = new Params();
$add_person = get_form_result($obj->get());
$person_added = add_personal_date($add_person["name"], $add_person["surname"], $add_person["age"]);
if ($person_added) {
    $person_id = get_id_by_name('Personal', $add_person["name"], $add_person["surname"], $add_person["age"]);
    $subjects = get_subjects();
    foreach ($subjects as $id => $name) {
        if ($add_person['subj' . $id]) {
            add_person_mark($person_id, $id, $add_person['subj' . $id]);
        }
    }
    if ($add_person["category"]) {
        add_person_cat($person_id, get_id_by_name('Categories', $add_person["category"]));
    }
    echo "<p class='added' >Person successfuly added!</p>";
}