コード例 #1
0
 * NOTE: This only handles updates. Currently does not handle inserts.
 * NOTE: There is no logic to check data types, required fields, foreign keys etc
 * This is meant to be a temporary solution to allow quick updates to user data.
 */
if (isset($_POST['form']) && $_POST['form'] == "get_presenters") {
    require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
    $presenter_ids = $_POST['presenter_ids'];
    if (strpos($presenter_ids, ',')) {
        $presetner_id_array = explode(",", $presenter_ids);
    } else {
        $presetner_id_array = explode("\n", $presenter_ids);
    }
    $result = array();
    $presenter_obj = new Presenter();
    foreach ($presetner_id_array as $value) {
        $presenter = $presenter_obj->getPresenterForAdministrative($value);
        if ($presenter->presenter_sequence_id > 0) {
            $result[] = $presenter;
        }
    }
    header("Content-type: text/csv");
    header("Content-Disposition: attachment; filename=presenters.csv");
    header("Pragma: no-cache");
    header("Expires: 0");
    echo "Presenter Number,First Name,Last Name,Address 1,Address 2,Address 3,City,State,Country,Email,\n";
    if ($result) {
        foreach ($result as $row) {
            echo "{$row->presenter_sequence_id},{$row->first_name},{$row->last_name},{$row->address1},{$row->address2},{$row->address3},{$row->city},{$row->state},{$row->country},{$row->email},\n";
        }
    }
}