コード例 #1
0
function getEntryTypeName($entry, $key)
{
    $key = str_replace('_name', '_id', $key);
    $entry_type = getEntryType($entry[$key]);
    if (!count($entry_type)) {
        return '';
    } else {
        return $entry_type['entry_type_name'];
    }
}
コード例 #2
0
	<td align="right"><b>' . _('Entry title') . ':</b> </td>
	<td>';
if ($entry['entry_title'] == '') {
    echo '<i>' . _('Non') . '</i>';
} else {
    echo $entry['entry_title'];
}
echo '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right">' . iconHTML('page_white_stack') . ' ' . '<b>' . _('Entry type') . ':</b> </td>
	<td>';
if ($entry['entry_type_id'] == '0') {
    echo '<i>' . _('Non') . '</i>';
} else {
    $entry_type = getEntryType($entry['entry_type_id']);
    if (count($entry_type)) {
        echo $entry_type['entry_type_name'];
    }
}
echo '</td>
</tr>' . chr(10);
echo '<tr>
	<td align="right">' . iconHTML('date_previous') . ' ' . '<b>' . _('Starts') . ':</b> </td>
	<td>';
echo date('H:i ', $entry['time_start']) . ' ' . strtolower(_(date('l', $entry['time_start']))) . ' ';
echo '<a href="day.php?year=' . date('Y', $entry['time_start']) . '&amp;month=' . date('m', $entry['time_start']) . '&amp;day=' . date('d', $entry['time_start']) . '&amp;area=' . $entry['area_id'] . '">' . date('j', $entry['time_start']) . '</a>. ';
echo '<a href="month.php?year=' . date('Y', $entry['time_start']) . '&amp;month=' . date('m', $entry['time_start']) . '&amp;day=' . date('d', $entry['time_start']) . '&amp;area=' . $entry['area_id'] . '">' . _(date('M', $entry['time_start'])) . '</a> ';
echo date('Y', $entry['time_start']);
echo '</td>
</tr>' . chr(10);
コード例 #3
0
    $editor->getDB();
    if (isset($_POST['editor_submit'])) {
        if ($editor->input($_POST)) {
            if ($editor->performDBquery()) {
                // Redirect
                header('Location: admin_entry_type.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['entry_type_id']) && isset($_GET['area_id'])) {
    $entry_type = getEntryType($_GET['entry_type_id']);
    if (!count($entry_type)) {
        echo 'Finner ikke typen.';
        exit;
    }
    $area = getArea($_GET['area_id']);
    if (!count($area)) {
        echo __('Can\'t find the area.');
        exit;
    }
    $entry_type_defaultattachment = getEntryTypeDefaultAttachment($_GET['entry_type_id'], $_GET['area_id']);
    $saved = false;
    if (isset($_POST['attSave'])) {
        if (!isset($_POST['attachment']) || !is_array($_POST['attachment'])) {
            $_POST['attachment'] = array();
        }
コード例 #4
0
ファイル: template.php プロジェクト: HNygard/JM-booking
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']);
    }
}
コード例 #5
0
     $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']);
     if (!count($conEntryType)) {
         include "include/admin_middel.php";
         templateError('Fant ikke bookingtypen du prøvde å koble til vedlegg nr ' . $att['att_id']);
         exit;
     }
     $conArea = getArea($_POST['connection_area']);
     if (!count($conArea)) {
         include "include/admin_middel.php";
         templateError('Fant ikke bygget du prøvde å koble til vedlegg nr ' . $att['att_id']);
         exit;
     }
     mysql_query("\n\t\t\t\tINSERT INTO `entry_type_defaultattachment`\n\t\t\t\t(\n\t\t\t\t\t`entry_type_id`, \n\t\t\t\t\t`area_id`, \n\t\t\t\t\t`att_id`\n\t\t\t\t) VALUES (\n\t\t\t\t\t'" . $conEntryType['entry_type_id'] . "',\n\t\t\t\t\t'" . $conArea['area_id'] . "',\n\t\t\t\t\t'" . $att['att_id'] . "'\n\t\t\t\t);\n\t\t\t\t");
     if (isset($_GET['redirect']) && $_GET['redirect'] == 'entry_type') {
         header('Location: admin_entry_type.php?entry_type_id=' . $conEntryType['entry_type_id']);
     } else {
コード例 #6
0
ファイル: functions.inc.php プロジェクト: HNygard/JM-booking
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;
}
コード例 #7
0
ファイル: email.php プロジェクト: hnJaermuseet/JM-booking
function template_ical($entry)
{
    // $entry = getEntry($entry_id) from sending_ical
    if (!count($entry)) {
        return '';
    }
    $return = '';
    $return .= __('Entry name') . ': ' . $entry['entry_name'] . chr(10);
    $return .= __('Entry ID') . ': ' . $entry['entry_id'] . chr(10);
    $return .= __('Entry type') . ': ';
    if ($entry['entry_type_id'] == '0') {
        $return .= __('Non');
    } else {
        $entry_type = getEntryType($entry['entry_type_id']);
        if (count($entry_type)) {
            $return .= $entry_type['entry_type_name'];
        }
    }
    $return .= chr(10);
    $return .= __('Starts') . ': ' . date('H:i d-m-Y', $entry['time_start']) . chr(10);
    $return .= __('Finished') . ': ' . date('H:i d-m-Y', $entry['time_end']) . chr(10);
    if (count($entry['user_assigned']) > 1) {
        $return .= chr(10);
    }
    $return .= __('Assigned to') . ': ';
    if (!count($entry['user_assigned'])) {
        $return .= __('Nobody') . chr(10);
    } elseif (count($entry['user_assigned']) == '1') {
        foreach ($entry['user_assigned'] as $user_id) {
            if ($user_id == '0') {
                $return .= __('Nobody') . chr(10);
            } else {
                $user = getUser($user_id);
                if (count($user)) {
                    $return .= $user['user_name'] . chr(10);
                }
            }
        }
    } else {
        foreach ($entry['user_assigned'] as $user_id) {
            $user = getUser($user_id);
            if (count($user)) {
                $return .= ' - ' . $user['user_name'] . chr(10);
            }
        }
    }
    $area = getArea($entry['area_id']);
    $return .= __('Area') . ': ' . $area['area_name'] . chr(10);
    $return .= __('Room') . ': ';
    if (!count($entry['room_id'])) {
        $return .= __('Whole area') . chr(10);
    } elseif (count($entry['room_id']) == '1') {
        // Single room
        foreach ($entry['room_id'] as $rid) {
            if ($rid == '0') {
                $return .= __('Whole area') . chr(10);
            } else {
                $room = getRoom($rid);
                if (count($room)) {
                    $return .= $room['room_name'] . chr(10);
                } else {
                    $return .= __('Can\'t find room') . chr(10);
                }
            }
        }
    } else {
        $rooms = false;
        foreach ($entry['room_id'] as $rid) {
            if ($rid != '0') {
                $rooms = true;
                $room = getRoom($rid);
                if (count($room)) {
                    $return .= ' - ' . $room['room_name'] . chr(10);
                }
            }
        }
        if (!$rooms) {
            $return .= __('Whole area') . chr(10);
        }
    }
    if ($entry['customer_id'] == '0') {
        $return .= __('Customer') . ': ' . __('Non selected') . chr(10);
    } else {
        $return .= __('Customer') . ': ' . $entry['customer_name'] . ' (' . __('Customer ID') . ' ' . $entry['customer_id'] . ')' . chr(10);
    }
    $return .= __('Customer') . ': ' . $entry['customer_name'] . chr(10);
    $return .= __('Contact person') . ': ' . $entry['contact_person_name'] . chr(10);
    $return .= __('Contact telephone') . ': ' . $entry['contact_person_phone'] . chr(10);
    $return .= __('Contact persons email') . ': ' . $entry['contact_person_email'] . chr(10);
    $return .= __('Municipal') . ': ' . $entry['customer_municipal'] . chr(10);
    $user_created = getUser($entry['created_by']);
    if (count($user_created)) {
        $return .= __('Booking created by') . ': ' . $user_created['user_name'] . chr(10);
    }
    $return .= __('Comment') . ':' . chr(10);
    $return .= nl2br($entry['comment']);
    return $return;
}