Example #1
0
	<td align="right"><b>' . _('Count in booking') . ':</b> </td>
	<td>';
if ($entry['num_person_count'] == '1') {
    echo _('Yes');
} else {
    echo _('No');
}
echo '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right">' . iconHTML('package') . ' <b>' . _('Fixed program') . ':</b> </td>
	<td>';
if ($entry['program_id'] == '0') {
    echo _('Non selected');
} else {
    $program = getProgram($entry['program_id']);
    if (count($program)) {
        echo $program['program_name'];
    }
}
echo '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right">' . iconHTML('script') . ' <b>' . _('Program description') . ':</b> </td>
	<td>' . nl2br($entry['program_description']) . '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right">' . iconHTML('drink') . ' <b>' . _('Service description') . ':</b> </td>
	<td>' . $entry['service_description'] . '</td>
</tr>' . chr(10);
echo '<tr>
function getProgramNameFromEntry($entry, $key)
{
    $key = str_replace('_name', '_id', $key);
    $program = getProgram($entry[$key]);
    if (count($program)) {
        return $program['program_name'];
    } else {
        return '';
    }
}
Example #3
0
function templateAssignEntry($var, $entry)
{
    global ${$var};
    if (count($entry)) {
        ${$var}->assign('entry_id', $entry['entry_id']);
        ${$var}->assign('entry_name', $entry['entry_name']);
        ${$var}->assign('entry_title', $entry['entry_title']);
        ${$var}->assign('confirm_email', $entry['confirm_email']);
        if ($entry['confirm_email']) {
            ${$var}->assign('confirm_email2', _('yes'));
        } else {
            ${$var}->assign('confirm_email2', _('no'));
        }
        ${$var}->assign('entry_type_id', $entry['entry_type_id']);
        if ($entry['entry_type_id'] == 0) {
            $entry_type = _('Non selected');
        } else {
            $entry_type = getEntryType($entry['entry_type_id']);
            if (count($entry_type)) {
                $entry_type = $entry_type['entry_type_name'];
            } else {
                $entry_type = 'ERROR';
            }
        }
        ${$var}->assign('entry_type', $entry_type);
        ${$var}->assign('num_person_child', $entry['num_person_child']);
        ${$var}->assign('num_person_adult', $entry['num_person_adult']);
        ${$var}->assign('num_person_count', $entry['num_person_count']);
        if ($entry['num_person_count']) {
            ${$var}->assign('num_person_count2', _('yes'));
        } else {
            ${$var}->assign('num_person_count2', _('no'));
        }
        ${$var}->assign('program_id', $entry['program_id']);
        $program = getProgram($entry['program_id']);
        if (count($program)) {
            ${$var}->assign('program_id_name', $program['program_name']);
            ${$var}->assign('program_id_desc', $program['program_desc']);
        } else {
            ${$var}->assign('program_id_name', '');
            ${$var}->assign('program_id_desc', '');
        }
        ${$var}->assign('program_description', $entry['program_description']);
        ${$var}->assign('service_alco', $entry['service_alco']);
        if ($entry['service_alco']) {
            ${$var}->assign('service_alco2', _('yes'));
        } else {
            ${$var}->assign('service_alco2', _('no'));
        }
        ${$var}->assign('service_description', $entry['service_description']);
        ${$var}->assign('comment', $entry['comment']);
        ${$var}->assign('infoscreen_txt', $entry['infoscreen_txt']);
        ${$var}->assign('time_start', $entry['time_start']);
        ${$var}->assign('time_end', $entry['time_end']);
        ${$var}->assign('room_id', $entry['room_id']);
        // Room
        $rooms = array();
        if (!count($entry['room_id'])) {
            $rooms[] = _('Whole area');
        } elseif (count($entry['room_id']) == '1') {
            // Single room
            foreach ($entry['room_id'] as $rid) {
                if ($rid == '0') {
                    $rooms[] = _('Whole area');
                } else {
                    $room = getRoom($rid);
                    if (count($room)) {
                        $rooms[] = $room['room_name'];
                    } else {
                        $rooms[] = 'ERROR';
                    }
                }
            }
        } else {
            foreach ($entry['room_id'] as $rid) {
                if ($rid != '0') {
                    $room = getRoom($rid);
                    if (count($room)) {
                        $rooms[] = $room['room_name'];
                    } else {
                        $rooms[] = 'ERROR';
                    }
                }
            }
        }
        if (!count($rooms)) {
            $rooms[] = _('Whole area');
        }
        ${$var}->assign('room', implode(', ', $rooms));
        ${$var}->assign('rooms', $rooms);
        ${$var}->assign('area_id', $entry['area_id']);
        // Area
        $area = getArea($entry['area_id']);
        if (count($area)) {
            $area = $area['area_name'];
        } else {
            $area = 'ERROR';
        }
        ${$var}->assign('area', $area);
        ${$var}->assign('user_assigned', $entry['user_assigned']);
        ${$var}->assign('user_assigned2', $entry['user_assigned2']);
        // User_assigned_names
        $names = array();
        $names2 = array();
        foreach ($entry['user_assigned'] as $user_id) {
            if ($user_id != 0) {
                $user = getUser($user_id);
                if (count($user)) {
                    $names[] = $user['user_name'];
                    $names2[] = '<a href="user.php?user_id=' . $user['user_id'] . '">' . $user['user_name'] . '</a>';
                } else {
                    $names[] = 'ERROR';
                    $names2[] = 'ERROR';
                }
            }
        }
        if ($entry['user_assigned2'] != '') {
            $names[] = $entry['user_assigned2'];
            $names2[] = $entry['user_assigned2'];
        }
        if (!count($names)) {
            $names[] = _('Nobody');
            $names2[] = _('Nobody');
            ${$var}->assign('user_assigned_any', false);
        } else {
            ${$var}->assign('user_assigned_any', true);
        }
        ${$var}->assign('user_assigned_names', implode(', ', $names));
        ${$var}->assign('user_assigned_names2', implode(', ', $names2));
        ${$var}->assign('customer_id', $entry['customer_id']);
        ${$var}->assign('customer_name', $entry['customer_name']);
        ${$var}->assign('contact_person_name', $entry['contact_person_name']);
        ${$var}->assign('contact_person_phone', $entry['contact_person_phone']);
        ${$var}->assign('contact_person_email', $entry['contact_person_email']);
        ${$var}->assign('customer_municipal_num', $entry['customer_municipal_num']);
        ${$var}->assign('customer_municipal', $entry['customer_municipal']);
        ${$var}->assign('created_by', $entry['created_by']);
        // created_by_name
        $user = getUser($entry['created_by']);
        if (count($user)) {
            ${$var}->assign('created_by_name', $user['user_name']);
        } else {
            ${$var}->assign('created_by_name', '');
        }
        ${$var}->assign('time_created', $entry['time_created']);
        ${$var}->assign('edit_by', $entry['edit_by']);
        // Edit_by_names
        $names = array();
        foreach ($entry['edit_by'] as $user_id) {
            $user = getUser($user_id);
            if (count($user)) {
                $names[] = $user['user_name'];
            } else {
                $names[] = 'ERROR';
            }
        }
        if (!count($names)) {
            $names[] = _('Nobody');
        }
        ${$var}->assign('edit_by_names', implode(', ', $names));
        ${$var}->assign('time_last_edit', $entry['time_last_edit']);
        ${$var}->assign('user_last_edit', $entry['user_last_edit']);
        $user = getUser($entry['user_last_edit']);
        if (count($user)) {
            ${$var}->assign('user_last_edit_name', $user['user_name']);
        } else {
            ${$var}->assign('user_last_edit_name', '');
        }
        ${$var}->assign('rev_num', $entry['rev_num']);
        ${$var}->assign('invoice', $entry['invoice']);
        if ($entry['invoice'] == '1') {
            ${$var}->assign('invoice2', true);
            ${$var}->assign('invoice3', _('yes'));
        } else {
            ${$var}->assign('invoice2', false);
            ${$var}->assign('invoice3', _('no'));
        }
        ${$var}->assign('invoice_status', $entry['invoice_status']);
        switch ($entry['invoice_status']) {
            case '0':
                ${$var}->assign('invoice_status2', _('not to be made'));
                break;
            case '1':
                ${$var}->assign('invoice_status2', 'skal lages, ikke klar');
                break;
            case '2':
                ${$var}->assign('invoice_status2', 'skal lages, klar til fakturering');
                break;
            case '3':
                ${$var}->assign('invoice_status2', 'faktura laget og sendt');
                break;
            case '4':
                ${$var}->assign('invoice_status2', 'betalt');
                break;
        }
        ${$var}->assign('invoice_electronic', $entry['invoice_electronic']);
        if ($entry['invoice_electronic'] == '1') {
            ${$var}->assign('invoice_electronic2', true);
            ${$var}->assign('invoice_electronic3', _('yes'));
        } else {
            ${$var}->assign('invoice_electronic2', false);
            ${$var}->assign('invoice_electronic3', _('no'));
        }
        ${$var}->assign('invoice_email', $entry['invoice_email']);
        ${$var}->assign('invoice_comment', $entry['invoice_comment']);
        ${$var}->assign('invoice_internal_comment', $entry['invoice_internal_comment']);
        ${$var}->assign('invoice_ref_your', $entry['invoice_ref_your']);
        ${$var}->assign('invoice_address_id', $entry['invoice_address_id']);
        $invoice_address = getAddress($entry['invoice_address_id']);
        if (count($invoice_address)) {
            ${$var}->assign('invoice_address', $invoice_address['address_full']);
        } else {
            ${$var}->assign('invoice_address', '');
        }
        ${$var}->assign('invoice_content', $entry['invoice_content']);
        ${$var}->assign('mva_vis', $entry['mva_vis']);
        ${$var}->assign('mva', $entry['mva']);
        ${$var}->assign('mva_grunnlag', $entry['mva_grunnlag']);
        ${$var}->assign('mva_grunnlag_sum', $entry['mva_grunnlag_sum']);
        ${$var}->assign('faktura_belop_sum', $entry['faktura_belop_sum']);
        ${$var}->assign('faktura_belop_sum_mva', $entry['faktura_belop_sum_mva']);
        ${$var}->assign('eks_mva_tot', $entry['eks_mva_tot']);
        ${$var}->assign('grunnlag_mva_tot', $entry['grunnlag_mva_tot']);
    }
}
Example #4
0
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
/*
	Administration of attachements
*/
$section = 'attachment';
include "include/admin_top.php";
/* View attachment */
if (isset($_GET['att_id'])) {
    $att = getAttachment($_GET['att_id'], true);
    if (count($att)) {
        if (isset($_POST['connection_program'])) {
            $conProgram = getProgram($_POST['connection_program']);
            if (!count($conProgram)) {
                include "include/admin_middel.php";
                templateError('Fant ikke programmet du prøvde å koble til vedlegg nr ' . $att['att_id']);
                exit;
            }
            mysql_query("\n\t\t\t\tINSERT INTO `programs_defaultattachment`\n\t\t\t\t(`program_id`, `att_id`) VALUES\n\t\t\t\t('" . $conProgram['program_id'] . "', '" . $att['att_id'] . "');\n\t\t\t\t");
            if (isset($_GET['redirect']) && $_GET['redirect'] == 'program') {
                header('Location: admin_programs.php?program_id=' . $conProgram['program_id']);
            } else {
                header('Location: ' . $_SERVER['PHP_SELF'] . '?att_id=' . $att['att_id']);
            }
            exit;
        }
        if (isset($_POST['connection_entry_type']) && isset($_POST['connection_area'])) {
            $conEntryType = getEntryType($_POST['connection_entry_type']);
Example #5
0
function readEntryLog($log)
{
    if (!count($log)) {
        return array();
    }
    $return = array();
    if ($log['log_action'] == 'add') {
        $middlestring = _('set to');
    } else {
        $middlestring = _('changed to');
    }
    foreach ($log['log_data'] as $index => $value) {
        if ($index != 'rev_num') {
            switch ($index) {
                case 'entry_name':
                    if ($value == '') {
                        $return[] = _('Entry name') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Entry name') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'entry_title':
                    if ($value == '') {
                        $return[] = _('Entry title') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Entry title') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'time_start':
                    $return[] = _('Start time') . ' ' . $middlestring . ' <i>' . date('H:i d-m-Y', $value) . '</i>';
                    break;
                case 'time_end':
                    $return[] = _('End time') . ' ' . $middlestring . ' <i>' . date('H:i d-m-Y', $value) . '</i>';
                    break;
                case 'area_id':
                    $area = getArea($value);
                    if (count($area)) {
                        $return[] = _('Area') . ' ' . $middlestring . ' <i>' . $area['area_name'] . '</i>';
                    } else {
                        $return[] = _('Area') . ' ' . $middlestring . ' <i>--' . _('Name not found') . '--</i>';
                    }
                    break;
                case 'room_id':
                    $value = splittIDs($value);
                    if (!count($value)) {
                        $return[] = _('Room') . ' ' . $middlestring . ' <i>' . _('Whole area') . '</i>';
                    } else {
                        $values = array();
                        foreach ($value as $id) {
                            if ($id == '0') {
                                $values[] = _('Whole area');
                            } else {
                                $thisone = getRoom($id);
                                if (count($thisone)) {
                                    $values[] = $thisone['room_name'];
                                }
                            }
                        }
                        $return[] = _('Room') . ' ' . $middlestring . ' <i>' . implode(', ', $values) . '</i>';
                    }
                    break;
                case 'user_assigned':
                    $value = splittIDs($value);
                    if (!count($value)) {
                        $return[] = _('Users assigned') . ' ' . $middlestring . ' <i>' . _('Nobody') . '</i>';
                    } else {
                        $values = array();
                        foreach ($value as $id) {
                            if ($id == '0') {
                                $values[] = _('Nobody');
                            } else {
                                $thisone = getUser($id);
                                if (count($thisone)) {
                                    $values[] = $thisone['user_name'];
                                }
                            }
                        }
                        $return[] = _('Users assigned') . ' ' . $middlestring . ' <i>' . implode(', ', $values) . '</i>';
                    }
                    break;
                case 'user_assigned2':
                    if ($value == '') {
                        $return[] = _('Manual user assigned') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Manual user assigned') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                    /*
                    				 * Not in use...
                    				 case 'customer_name':
                    					$return .= _('Customer').' '.$middlestring.' "'.$value.'"';
                    					break;*/
                /*
                				 * Not in use...
                				 case 'customer_name':
                					$return .= _('Customer').' '.$middlestring.' "'.$value.'"';
                					break;*/
                case 'customer_id':
                    if ($value == 0) {
                        $return[] = _('Customer') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $customer = getCustomer($value);
                        if (count($customer)) {
                            $return[] = _('Customer') . ' ' . $middlestring . ' <i>' . $customer['customer_name'] . '</i>';
                        } else {
                            $return[] = _('Customer ID') . ' ' . $middlestring . ' "' . $value . '"';
                        }
                    }
                    break;
                    /*
                    				 * Not in use...	
                    				case 'customer_municipal':
                    					$return .= _('Municipal').' '.$middlestring.' "'.$value.'"';
                    					break;*/
                /*
                				 * Not in use...	
                				case 'customer_municipal':
                					$return .= _('Municipal').' '.$middlestring.' "'.$value.'"';
                					break;*/
                case 'customer_municipal_num':
                    require "libs/municipals_norway.php";
                    if (isset($municipals[$value])) {
                        $return[] = _('Municipal') . ' ' . $middlestring . ' <i>' . $municipals[$value] . '</i>';
                    } elseif ($value == '') {
                        $return[] = _('Municipal') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Municipal') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'contact_person_name':
                    if ($value == '') {
                        $return[] = _('Contact person') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Contact person') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'contact_person_phone':
                    if ($value == '') {
                        $return[] = _('Contact persons phone number') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Contact persons phone number') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'contact_person_email':
                    if ($value == '') {
                        $return[] = _('Contact persons email') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Contact persons email') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'num_person_child':
                    if ($value == "" || $value == 0) {
                        $return[] = _('Number of children') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Number of children') . ' ' . $middlestring . ' ' . $value;
                    }
                    break;
                case 'num_person_adult':
                    if ($value == "" || $value == 0) {
                        $return[] = _('Number of adults') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Number of adults') . ' ' . $middlestring . ' ' . $value;
                    }
                    break;
                case 'num_person_count':
                    if ($value == "" || $value == 0) {
                        $return[] = _('Count these numbers') . ' ' . $middlestring . ' <i>' . _('not count in booking system / Datanova / cash register') . '</i>';
                    } else {
                        $return[] = _('Count these numbers') . ' ' . $middlestring . ' <i>' . _('count in booking system') . '</i>';
                    }
                    break;
                case 'program_description':
                    if ($value == '') {
                        $return[] = _('Program description') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Program description') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'service_alco':
                    if ($value) {
                        $return[] = _('Alcohol') . ' <i>' . _('is to be served') . '</i>';
                    } else {
                        $return[] = _('Alcohol') . ' <i>' . _('is not to be served') . '</i>';
                    }
                    break;
                case 'service_description':
                    if ($value == '') {
                        $return[] = _('Service description') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Service description') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'comment':
                    if ($value == '') {
                        $return[] = _('Comment') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Comment') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'infoscreen_txt':
                    if ($value == '') {
                        $return[] = _('Text on infoscreen') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Text on infoscreen') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'invoice':
                    if ($value) {
                        $return[] = _('Invoice') . ' <i>' . _('should be made') . '</i>';
                    } else {
                        $return[] = _('Invoice') . ' <i>' . _('should not be made') . '</i>';
                    }
                    break;
                case 'invoice_info':
                case 'invoice_internal_comment':
                    if ($value == '') {
                        $return[] = _('Invoice') . ' - ' . _('Internal comment') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Invoice') . ' - ' . _('Internal comment') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'invoice_comment':
                    if ($value == '') {
                        $return[] = _('Invoice') . ' - ' . _('Comment') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Invoice') . ' - ' . _('Comment') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'invoice_ref_your':
                    if ($value == '') {
                        $return[] = _('Invoice') . ' - ' . _('Your reference') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Invoice') . ' - ' . _('Your reference') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'invoice_electronic':
                    if ($value) {
                        $return[] = _('Invoice') . ' <i>' . _('is to be sendt by e-mail') . '</i> (' . _('E-delivery') . ')';
                    } else {
                        $return[] = _('Invoice') . ' <i>' . _('is to be sendt by regular mail') . '</i> (' . _('Not') . ' ' . strtolower(_('E-delivery')) . ')';
                    }
                    break;
                case 'invoice_email':
                    if ($value == '') {
                        $return[] = _('Invoice') . ' - ' . _('E-mail') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $return[] = _('Invoice') . ' - ' . _('E-mail') . ' ' . $middlestring . ' "' . $value . '"';
                    }
                    break;
                case 'invoice_address_id':
                    if ($value == 0) {
                        $return[] = _('Invoice') . ' - ' . _('Address') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $address = getAddress($value);
                        if (count($address)) {
                            $return[] = _('Invoice') . ' - ' . _('Address') . ' ' . $middlestring . ' <i>' . str_replace("\n", ', ', $address['address_full']) . '</i>';
                        } else {
                            $return[] = _('Invoice') . ' - ' . _('Address') . ' ' . $middlestring . ' "' . $value . '"';
                        }
                    }
                    break;
                case 'invoice_content':
                    if (!is_array($value)) {
                        $return[] = _('Invoice') . ' - ' . _('Content') . ' has got syntax error in the log.';
                    } else {
                        foreach ($value as $linenr => $line) {
                            $return[] = _('Invoice') . ' - ' . _('Content') . ' - ' . _('line') . ' <i>' . $linenr . '</i> ' . $middlestring . ': ' . _('name') . ': <i>' . $line['name'] . '</i>, ' . 'pris/stk: <i>' . $line['belop_hver'] . '</i>, ' . _('amount') . ': <i>' . $line['antall'] . '</i>, ' . _('tax') . ': <i>' . $line['mva'] * 100 . '%</i>, ' . 'sum u/MVA: <i>' . $line['belop_sum_netto'] . '</i>';
                        }
                    }
                    break;
                case 'program_id':
                    if ($value == 0) {
                        $return[] = _('Fixed program') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $program = getProgram($value);
                        if (count($program)) {
                            $return[] = _('Fixed program') . ' ' . $middlestring . ' <i>' . $program['program_name'] . '</i>';
                        } else {
                            $return[] = _('ID of fixed program') . ' ' . $middlestring . ' "' . $value . '"';
                        }
                    }
                    break;
                case 'entry_type_id':
                    if ($value == 0) {
                        $return[] = _('Entry type') . ' <i>' . _('not set') . '</i>';
                    } else {
                        $entry_type = getEntryType($value);
                        if (count($entry_type)) {
                            $return[] = _('Entry type') . ' ' . $middlestring . ' <i>' . $entry_type['entry_type_name'] . '</i>';
                        } else {
                            $return[] = _('ID of entry type') . ' ' . $middlestring . ' "' . $value . '"';
                        }
                    }
                    break;
                case 'confirm_id':
                    $return[] = '<a href="entry_confirm_view.php?confirm_id=' . $value . '">' . _('Confirmation sent') . '</a>';
                    break;
                case 'confirm_comment':
                    $return[] = _('Comment') . ': ' . $value;
                    break;
                default:
                    if (substr($index, 0, 11) == 'email_faild') {
                        $return[] = _('Confirmation was <b>not sent</b> to') . ' <i>' . $value . '</i>';
                        break;
                    } elseif (substr($index, 0, 5) == 'email') {
                        $return[] = _('Confirmation was sent to') . ' <i>' . $value . '</i>';
                        break;
                    }
                    if (is_array($value)) {
                        $return[] = $index . ' = ' . print_r($value, true);
                    } else {
                        $return[] = $index . ' = ' . $value;
                    }
                    break;
            }
        }
    }
    return $return;
}
Example #6
0
    $editor->getDB();
    if (isset($_POST['editor_submit'])) {
        if ($editor->input($_POST)) {
            if ($editor->performDBquery()) {
                // Redirect
                header('Location: admin_programs.php');
                exit;
            } else {
                echo 'Error occured while performing query on database:<br>' . chr(10), exit;
            }
        }
    }
    include "include/admin_middel.php";
    $editor->printEditor();
} elseif (isset($_GET['program_id'])) {
    $program = getProgram($_GET['program_id']);
    if (!count($program)) {
        echo 'Finner ikke programmet.';
        exit;
    }
    $program_defaultattachment = getProgramDefaultAttachment($_GET['program_id']);
    $saved = false;
    if (isset($_POST['attSave'])) {
        if (!isset($_POST['attachment']) || !is_array($_POST['attachment'])) {
            $_POST['attachment'] = array();
        }
        // Accept the changes in attachments
        $att_new = array();
        $att_deleted = $program_defaultattachment;
        foreach ($_POST['attachment'] as $att_id) {
            $att = getAttachment($att_id);