Ejemplo n.º 1
0
    public static function print_note($note_id, $note_item, $display_summary = false, $can_edit = true, $can_delete = true, $options = array())
    {
        if (!$note_item) {
            $note_item = self::get_note($note_id);
        }
        static $x = 0;
        global $plugins;
        $can_view = $can_edit = $can_create = $can_delete = false;
        // re-check permissions...
        if (isset($options) && isset($options['owner_table']) && $options['owner_table'] && isset($options['title']) && $options['title']) {
            $can_view = $plugins[$options['owner_table']]->can_i('view', $options['title']);
            $can_edit = $plugins[$options['owner_table']]->can_i('edit', $options['title']);
            $can_create = $plugins[$options['owner_table']]->can_i('create', $options['title']);
            $can_delete = $plugins[$options['owner_table']]->can_i('delete', $options['title']);
        } else {
        }
        if (!module_security::is_page_editable()) {
            //$can_edit=$can_create=$can_delete=false;
        }
        if (isset($options['summary_owners'])) {
            unset($options['summary_owners']);
        }
        if (isset($options['display_summary'])) {
            unset($options['display_summary']);
        }
        //
        if (!trim($note_item['note'])) {
            $note_item['note'] = 'none';
        }
        ob_start();
        /** START TABLE LAYOUT **/
        $table_manager = module_theme::new_table_manager();
        $columns = array();
        $columns['date'] = array('title' => 'Date', 'width' => 60, 'callback' => function ($note_item) {
            if ($note_item['reminder']) {
                echo '<strong>';
            }
            echo print_date($note_item['note_time']);
            if ($note_item['reminder']) {
                echo '</strong>';
            }
        });
        $columns['description'] = array('title' => 'Description', 'callback' => function ($note_item) {
            if (isset($note_item['public']) && $note_item['public']) {
                echo '* ';
            }
            if ($note_item['can_edit']) {
                $note_text = nl2br(htmlspecialchars(substr($note_item['note'], 0, module_config::c('note_trim_length', 35))));
                $note_text .= strlen($note_item['note']) > module_config::c('note_trim_length', 35) ? '...' : '';
                ?>

                <a href="<?php 
                echo module_note::link_open($note_item['note_id'], false, $note_item['options']);
                ?>
" data-options="<?php 
                echo htmlspecialchars(base64_encode(serialize($note_item['options'])));
                ?>
" class="note_edit note_options_link" rel="<?php 
                echo $note_item['note_id'];
                ?>
"> <?php 
                echo $note_text;
                ?>
 </a>
                <?php 
            } else {
                echo forum_text($note_item['note']);
            }
        });
        $columns['info'] = array('title' => 'Info', 'width' => 40, 'callback' => function ($note_item) {
            if ($note_item['display_summary']) {
                if ($note_item['rel_data']) {
                    global $plugins;
                    echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'], true);
                }
            } else {
                // find the user name who made thsi note.
                $user_data = module_user::get_user($note_item['create_user_id']);
                echo $user_data['name'];
            }
        });
        if ($can_delete) {
            $columns['del'] = array('title' => ' ', 'callback' => function ($note_item) {
                if ($note_item['can_delete']) {
                    ?>
 <a href="<?php 
                    echo module_note::link_open($note_item['note_id'], false, array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])));
                    ?>
" data-options="<?php 
                    echo htmlspecialchars(base64_encode(serialize(array_merge($note_item['options'], array('do_delete' => 'yes', 'note_id' => $note_item['note_id'])))));
                    ?>
" rel="<?php 
                    echo $note_item['note_id'];
                    ?>
" onclick="if(confirm('<?php 
                    _e('Really Delete Note?');
                    ?>
'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a> <?php 
                }
            });
        }
        $table_manager->set_columns($columns);
        $table_manager->inline_table = true;
        $table_manager->row_callback = function ($row_data, &$row_object) use($display_summary, $can_edit, $can_delete, &$options) {
            $row_data['display_summary'] = $display_summary;
            $row_data['can_edit'] = $can_edit;
            $row_data['can_delete'] = $can_delete;
            $row_data['options'] = $options;
            $row_object->row_id = 'note_' . $row_data['note_id'];
            return $row_data;
        };
        $table_manager->print_row($note_item);
        /*?>
        		<tr id="note_<?php echo $note_item['note_id'];?>" class="<?php echo ($x++%2)?'odd':'even';?>">
        			<td>
                        <?php
                        if($note_item['reminder'])echo '<strong>';
                        echo print_date($note_item['note_time']);
                        if($note_item['reminder'])echo '</strong>';
                        ?>
        			</td>
        			<td>
                        <?php
                        if(isset($note_item['public']) && $note_item['public'])echo '* ';
                        if($can_edit){
                            $note_text = nl2br(htmlspecialchars(substr($note_item['note'],0,module_config::c('note_trim_length',35))));
                            $note_text .= strlen($note_item['note']) > module_config::c('note_trim_length',35) ? '...' : '';
                            ?>
                        <a href="<?php echo self::link_open($note_item['note_id'],false,$options);?>" data-options="<?php echo htmlspecialchars(base64_encode(serialize($options)));?>" class="note_edit note_options_link" rel="<?php echo $note_item['note_id'];?>"> <?php echo $note_text; ?> </a>
                        <?php }else{
                            echo forum_text($note_item['note']);
                        } ?>
        			</td>
        			<td nowrap="nowrap">
        				<?php
        				if($display_summary){
        					if($note_item['rel_data']){
                                echo $plugins[$note_item['owner_table']]->link_open($note_item['owner_id'],true);
        					}
        				}else{
        					// find the user name who made thsi note.
        					$user_data = module_user::get_user($note_item['create_user_id']);
        					echo $user_data['name'];
        				}
        				?>
        			</td>
                    <?php if($can_delete){ ?>
                    <td><a href="<?php echo self::link_open($note_item['note_id'],false,array_merge($options,array('do_delete'=>'yes','note_id'=>$note_item['note_id'])));?>" data-options="<?php echo htmlspecialchars(base64_encode(serialize(array_merge($options,array('do_delete'=>'yes','note_id'=>$note_item['note_id'])))));?>" rel="<?php echo $note_item['note_id'];?>" onclick="if(confirm('<?php _e('Really Delete Note?');?>'))return true; else return false;" class="note_delete note_options_link delete ui-state-default ui-corner-all ui-icon ui-icon-trash">[x]</a></td>
                    <?php } ?>
        		</tr>
        		<?php
        		*/
        return ob_get_clean();
    }
Ejemplo n.º 2
0
    public static function display_extras($options)
    {
        $owner_id = isset($options['owner_id']) && $options['owner_id'] ? (int) $options['owner_id'] : false;
        $owner_table = isset($options['owner_table']) && $options['owner_table'] ? $options['owner_table'] : false;
        $layout = isset($options['layout']) && $options['layout'] ? $options['layout'] : false;
        $allow_new = true;
        if (isset($options['allow_new']) && !$options['allow_new']) {
            $allow_new = false;
        }
        $allow_edit = !isset($options['allow_edit']) || isset($options['allow_edit']) && $options['allow_edit'];
        if (!module_security::is_page_editable()) {
            $allow_edit = false;
        }
        // todo ^^ flow this permission check through to the "save" section.
        $html = '';
        if ($owner_table) {
            $default_fields = self::get_defaults($owner_table);
            // we have all that we need to display some extras!! yey!!
            if ($owner_id) {
                $extra_items = self::get_extras(array('owner_table' => $owner_table, 'owner_id' => $owner_id));
                $extra_items = self::sort_extras($extra_items, $default_fields);
            } else {
                $extra_items = array();
            }
            foreach ($extra_items as $extra_item) {
                $extra_id = $extra_item['extra_id'];
                $id = 'extra_' . preg_replace('#\\W+#', '_', $extra_item['extra_key']);
                ob_start();
                ?>

                <tr id="extra_<?php 
                echo $extra_id;
                ?>
">
                    <th <?php 
                if (module_config::can_i('edit', 'Settings') && self::can_i('edit', 'Extra Fields') && isset($default_fields[$extra_item['extra_key']]['field_type'])) {
                    echo ' data-settings-url="' . module_extra::link_open_extra_default($default_fields[$extra_item['extra_key']]['extra_default_id'], false) . '"';
                }
                ?>
>
                        <?php 
                if ($allow_edit) {
                    ?>

                            <span class="extra_field_key" onclick="$(this).hide(); $(this).parent().find('input').show();"><?php 
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>
</span>
                            <input type="text" name="extra_<?php 
                    echo $owner_table;
                    ?>
_field[<?php 
                    echo $extra_id;
                    ?>
][key]" value="<?php 
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>
" class="extra_field" style="display:none;">
                        <?php 
                } else {
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>

                            <input type="hidden" name="extra_<?php 
                    echo $owner_table;
                    ?>
_field[<?php 
                    echo $extra_id;
                    ?>
][key]" value="<?php 
                    echo htmlspecialchars($extra_item['extra_key']);
                    ?>
">
                        <?php 
                }
                ?>

                    </th>
                    <td>
                        <?php 
                if ($allow_edit) {
                    $field_type = 'text';
                    if (isset($default_fields[$extra_item['extra_key']]['field_type'])) {
                        $field_type = $default_fields[$extra_item['extra_key']]['field_type'];
                    }
                    if (!$field_type) {
                        $field_type = 'text';
                    }
                    $form_element = array('type' => $field_type, 'name' => 'extra_' . $owner_table . '_field[' . $extra_id . '][val]', 'value' => $extra_item['extra'], 'class' => 'extra_value_input', 'id' => $id);
                    if ($field_type == 'select') {
                        $form_element['options'] = array();
                        if (isset($default_fields[$extra_item['extra_key']]['options']) && is_array($default_fields[$extra_item['extra_key']]['options']) && isset($default_fields[$extra_item['extra_key']]['options']['select'])) {
                            foreach (explode("\n", $default_fields[$extra_item['extra_key']]['options']['select']) as $val) {
                                $val = trim($val);
                                if ($val === '') {
                                    continue;
                                }
                                $form_element['options'][$val] = $val;
                            }
                        }
                    }
                    module_form::generate_form_element($form_element);
                } else {
                    echo nl2br($extra_item['extra']);
                }
                /* <input type="text" name="extra_<?php echo $owner_table;?>_field[<?php echo $extra_id;?>][val]" id="<?php echo $id;?>" class="extra_value_input" value="<?php echo htmlspecialchars($extra_item['extra']);?>"> */
                ?>

                    </td>
                </tr>
                <?php 
                $html .= ob_get_clean();
            }
            if (module_security::is_page_editable() && $allow_new) {
                $extra_id = 'new';
                ob_start();
                // check if there are any "more" fields to add
                $more_fields_available = $allow_new;
                //if(!$more_fields_available){
                foreach ($default_fields as $default_id => $default) {
                    // check this key islany already existing.
                    foreach ($extra_items as $extra_item) {
                        if ($extra_item['extra_key'] == $default['key']) {
                            unset($default_fields[$default_id]);
                            continue 2;
                        }
                    }
                    $more_fields_available = true;
                }
                //}
                if ($more_fields_available) {
                    ?>

                    <tr id="extra_<?php 
                    echo $owner_table;
                    ?>
_options_<?php 
                    echo $extra_id;
                    ?>
" <?php 
                    if (!module_config::c('hide_extra', 1)) {
                        ?>
style="display:none;"<?php 
                    }
                    ?>
>
                        <th>

                        </th>
                        <td>
                            <a href="#" onclick="$('#extra_<?php 
                    echo $owner_table;
                    ?>
_options_<?php 
                    echo $extra_id;
                    ?>
').hide();$('#extra_<?php 
                    echo $owner_table;
                    ?>
_holder_<?php 
                    echo $extra_id;
                    ?>
').show(); return false;"><?php 
                    _e('more fields &raquo;');
                    ?>
</a>
                        </td>
                    </tr>
                <?php 
                }
                // more fields available
                ?>


                <?php 
                if (count($default_fields) || $allow_new) {
                    ?>

                    <tbody id="extra_<?php 
                    echo $owner_table;
                    ?>
_holder_<?php 
                    echo $extra_id;
                    ?>
" <?php 
                    if (module_config::c('hide_extra', 1)) {
                        ?>
style="display:none;"<?php 
                    }
                    ?>
>
                    <!-- show all other options here from this $owner_table -->
                    <?php 
                    $defaultid = 0;
                    foreach ($default_fields as $default) {
                        $defaultid++;
                        $id = 'extra_' . preg_replace('#\\W+#', '_', $default['key']);
                        ?>

                        <tr>
                            <th>

                                <?php 
                        if ($allow_edit) {
                            ?>

                                    <span class="extra_field_key" onclick="$(this).hide(); $(this).parent().find('input').show();"><?php 
                            echo htmlspecialchars($default['key']);
                            ?>
</span>
                                    <input type="text" name="extra_<?php 
                            echo $owner_table;
                            ?>
_field[new<?php 
                            echo $defaultid;
                            ?>
][key]" value="<?php 
                            echo htmlspecialchars($default['key']);
                            ?>
" class="extra_field" style="display:none;">
                                <?php 
                        } else {
                            echo htmlspecialchars($default['key']);
                            ?>

                                    <input type="hidden" name="extra_<?php 
                            echo $owner_table;
                            ?>
_field[new<?php 
                            echo $defaultid;
                            ?>
][key]" value="<?php 
                            echo htmlspecialchars($default['key']);
                            ?>
">
                                <?php 
                        }
                        ?>


                            </th>
                            <td>
                                <?php 
                        $field_type = $default['field_type'];
                        if (!$field_type) {
                            $field_type = 'text';
                        }
                        $form_element = array('type' => $field_type, 'name' => 'extra_' . $owner_table . '_field[new' . $defaultid . '][val]', 'value' => '', 'class' => 'extra_value_input', 'id' => $id);
                        if ($field_type == 'select') {
                            $form_element['options'] = array();
                            if (isset($default['options']) && is_array($default['options']) && isset($default['options']['select'])) {
                                foreach (explode("\n", $default['options']['select']) as $val) {
                                    $val = trim($val);
                                    if ($val === '') {
                                        continue;
                                    }
                                    $form_element['options'][$val] = $val;
                                }
                            }
                        }
                        module_form::generate_form_element($form_element);
                        /*<input type="text" name="extra_<?php echo $owner_table;?>_field[new<?php echo $defaultid;?>][val]" id="<?php echo $id;?>" value="<?php ?>">*/
                        ?>


                            </td>
                        </tr>
                    <?php 
                    }
                    ?>

                    <?php 
                    if ($allow_new) {
                        ?>

                        <tr id="extra_<?php 
                        echo $extra_id;
                        ?>
">
                            <th>
                                <input type="text" name="extra_<?php 
                        echo $owner_table;
                        ?>
_field[<?php 
                        echo $extra_id;
                        ?>
][key]" value="<?php 
                        ?>
" class="extra_field">
                            </th>
                            <td>
                                <input type="text" name="extra_<?php 
                        echo $owner_table;
                        ?>
_field[<?php 
                        echo $extra_id;
                        ?>
][val]" value="<?php 
                        ?>
">
                                <?php 
                        _h('Enter anything you like in this blank field. eg: Passwords, Links, Notes, etc..');
                        ?>

                            </td>
                        </tr>
                    <?php 
                    }
                    ?>

                    </tbody>
                <?php 
                }
                // defaults / allow new
                $html .= ob_get_clean();
            }
            // is page editable
        }
        // pass it out for a hook
        // this is really only used in the security module.
        if (function_exists('hook_filter_var')) {
            $html = hook_filter_var('extra_fields_output', $html, $owner_table, $owner_id);
        } else {
            $result = hook_handle_callback('extra_fields_output', $html, $owner_table, $owner_id);
            if ($result && count($result)) {
                foreach ($result as $r) {
                    $html = $r;
                    // bad. handle multiple hooks.
                }
            }
        }
        print $html;
    }
Ejemplo n.º 3
0
                foreach ($details['log'] as $log) {
                    echo '<li>' . htmlspecialchars($log) . '</li>';
                }
                ?>

                                                    </ul>
                                                </div>
                                                <?php 
            }
        }
        ?>

                                    </td>
                                    <td align="center" style="white-space: nowrap">
	                                    <?php 
        if (module_invoice::can_i('edit', 'Invoice Payments') && module_security::is_page_editable()) {
            ?>

		                                    <a href="#"
		                                       onclick="editinvoice_payment('<?php 
            echo $invoice_payment_id;
            ?>
',0); return false;"><?php 
            _e('Edit');
            ?>
</a> |
	                                    <?php 
        }
        // more details to the finance section
        if (class_exists('module_finance', false) && module_finance::is_plugin_enabled() && module_finance::can_i('view', 'Finance') && module_finance::is_enabled()) {
            // check if this finance has been added to the finance section yet.
Ejemplo n.º 4
0
					    <input type="hidden" name="default_tasks_action" id="default_tasks_action" value="0">
					    <?php 
            _h('Here you can save the current tasks as defaults to be used later, or insert a previously saved set of defaults.');
        }));
    }
    //
    if (module_config::c('job_show_task_numbers', 1)) {
        $fieldset_data['elements'][] = array('title' => 'Task Numbers', 'field' => array('type' => 'select', 'options' => array(0 => _l('Automatic'), 1 => _l('Manual'), 2 => _l('Hidden')), 'name' => 'auto_task_numbers', 'value' => $job['auto_task_numbers']));
    }
    $fieldset_data['elements'][] = array('title' => 'Task Type', 'field' => array('type' => 'select', 'options' => module_job::get_task_types(), 'name' => 'default_task_type', 'value' => isset($job['default_task_type']) ? $job['default_task_type'] : 0, 'help' => 'The default is hourly rate + amount. This will show the "Hours" column along with an "Amount" column. Inputing a number of hours will auto complete the price based on the job hourly rate. <br>Quantity and Amount will allow you to input a Quantity (eg: 2) and an Amount (eg: $100) and the final price will be $200 (Quantity x Amount). The last option "Amount Only" will just have the amount column for manual input of price. Change the advanced setting "default_task_type" between 0, 1 and 2 to change the default here.'));
    $fieldset_data['elements'][] = array('title' => 'Discount Amount', 'fields' => array(function () use($job_id, &$job) {
        echo !module_security::is_page_editable() ? '<span class="currency">' . dollar($job['discount_amount'], true, $job['currency_id']) . '</span>' : currency('<input type="text" name="discount_amount" value="' . number_out($job['discount_amount']) . '" class="currency">');
        echo ' ';
    }, array('type' => 'html', 'value' => '', 'help' => 'Here you can apply a before tax discount to this job. You can name this anything, eg: DISCOUNT, CREDIT, REFUND, etc..')));
    $fieldset_data['elements'][] = array('title' => 'Discount Name', 'fields' => array(function () use($job_id, &$job) {
        echo !module_security::is_page_editable() ? htmlspecialchars(_l($job['discount_description'])) : '<input type="text" name="discount_description" value="' . htmlspecialchars(_l($job['discount_description'])) . '" style="width:80px;">';
    }));
    $fieldset_data['elements'][] = array('title' => 'Discount Type', 'field' => array('type' => 'select', 'options' => array('0' => _l('Before Tax'), 1 => _l('After Tax')), 'name' => 'discount_type', 'value' => $job['discount_type']));
    if (class_exists('module_job_discussion', false) && isset($job['job_discussion']) && module_job_discussion::is_plugin_enabled()) {
        $fieldset_data['elements'][] = array('title' => 'Job Discussion', 'field' => array('type' => 'select', 'options' => array(0 => _l('Allowed'), 1 => _l('Disabled & Hidden'), 2 => _l('Disabled & Shown')), 'name' => 'job_discussion', 'value' => isset($job['job_discussion']) ? $job['job_discussion'] : 0));
    }
    if ((int) $job_id > 0 && module_invoice::can_i('create', 'Invoices')) {
        $fieldset_data['elements'][] = array('title' => 'Job Deposit', 'fields' => array(array('type' => 'currency', 'name' => 'job_deposit', 'value' => ''), array('type' => 'submit', 'name' => 'butt_create_deposit', 'value' => 'Create Deposit Invoice', 'class' => 'exit_button small_button', 'help' => 'Enter a dollar value here to create a deposit invoice for this job. Also supports entering a percentage (eg: 20%%)')));
    }
    $fieldset_data['elements'][] = array('title' => 'Job Completed', 'fields' => array(array('type' => 'text', 'name' => 'total_percent_complete_override', 'value' => $job['total_percent_complete_manual'] ? $job['total_percent_complete'] * 100 : '', 'style' => 'width:30px;'), '%', $job['total_percent_complete_manual'] ? _l('(calculated: %s%%)', $job['total_percent_complete_calculated'] * 100) : '', array('type' => 'html', 'value' => '', 'help' => 'Enter a manual job "percent completed" here and this will be used instead of the automatically calculated value.')));
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
$form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'onclick' => "\$('#form_redirect').val('" . module_job::link_open(false) . "');", 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save Job')), array('ignore' => !((int) $job_id && module_job::can_i('delete', 'Jobs')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_job::link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
?>
Ejemplo n.º 5
0
        ?>
" id="taxable_t_new">
                    <input type="hidden" name="job_task[new][manual_task_type]" value="-1" id="manual_task_type_new">
                </td>
            </tr>
            </tbody>
            <?php 
    }
    ?>

            <?php 
    $c = 0;
    $task_number = 0;
    foreach ($job_tasks as $task_id => $task_data) {
        $task_number++;
        if (module_security::is_page_editable() && module_job::can_i('edit', 'Job Tasks')) {
            ?>

                    <tbody id="task_edit_<?php 
            echo $task_id;
            ?>
" style="display:none;" class="task_edit"></tbody>
                <?php 
        } else {
            $task_editable = false;
        }
        echo module_job::generate_task_preview($job_id, $job, $task_id, $task_data, false, array('from_quote' => isset($_REQUEST['from_quote_id'])));
        ?>

                <input type="hidden" name="job_task[new<?php 
        echo $task_number;
Ejemplo n.º 6
0
    public static function display_groups($options)
    {
        //if(!self::can_i('view','Group','Groups'))return '';
        $owner_id = isset($options['owner_id']) && $options['owner_id'] ? (int) $options['owner_id'] : false;
        $owner_table = isset($options['owner_table']) && $options['owner_table'] ? $options['owner_table'] : false;
        //default to true.
        $can_create = $can_edit = $can_view = $can_delete = true;
        if ($options && isset($options['bypass_security'])) {
            // do nothing?
        } else {
            if (isset($options) && isset($options['owner_table']) && $options['owner_table'] && isset($options['title']) && $options['title']) {
                global $plugins;
                if (isset($plugins[$options['owner_table']])) {
                    $can_create = $can_edit = $can_view = $can_delete = false;
                    // default to false if permissions exist.
                    $can_view = $plugins[$options['owner_table']]->can_i('view', $options['title']);
                    $can_edit = $plugins[$options['owner_table']]->can_i('edit', $options['title']);
                    $can_create = $plugins[$options['owner_table']]->can_i('create', $options['title']);
                    $can_delete = $plugins[$options['owner_table']]->can_i('delete', $options['title']);
                }
            }
        }
        if (!$can_view) {
            return;
        }
        //$html = '';
        if ($owner_id && $owner_table) {
            // we have all that we need to display some groups!! yey!!
            // get a list of all groups.
            $fieldset_data = array();
            $responsive_summary = array();
            $group_items = self::get_groups($owner_table);
            foreach ($group_items as $key => $group_item) {
                $group_id = $group_item['group_id'];
                $sql = "SELECT * FROM `" . _DB_PREFIX . "group_member` gm WHERE `group_id` = {$group_id} AND `owner_id` = '" . mysql_real_escape_string($owner_id) . "' AND owner_table = '" . mysql_real_escape_string($owner_table) . "'";
                $res = query($sql);
                if (mysql_num_rows($res)) {
                    $group_items[$key]['checked'] = true;
                    $responsive_summary[] = htmlspecialchars($group_item['name']);
                }
                mysql_free_result($res);
            }
            if (isset($options['title']) && $options['title']) {
                $fieldset_data['heading'] = array('title' => $options['title'], 'type' => 'h3', 'responsive' => array('summary' => implode(', ', $responsive_summary)));
            }
            ob_start();
            //<div class="content_box_wheader">
            ?>

            <table class="tableclass tableclass_full tableclass_form">
                <tbody>
                    <?php 
            if (isset($options['description']) && $options['description']) {
                ?>

                        <tr>
                            <td colspan="2">
                                <?php 
                echo $options['description'];
                ?>

                            </td>
                        </tr>
                    <?php 
            }
            foreach ($group_items as $group_item) {
                $group_id = $group_item['group_id'];
                ?>

                        <tr id="group_<?php 
                echo $group_id;
                ?>
">
                            <th class="width1"<?php 
                if (self::can_i('edit', 'Groups')) {
                    ?>
 data-settings-url="<?php 
                    echo module_group::link_open($group_id, false);
                    ?>
" <?php 
                }
                ?>
>
                                <?php 
                if ($can_edit) {
                    ?>

                                <input type="hidden" name="group_module[<?php 
                    echo $owner_table;
                    ?>
][<?php 
                    echo $group_id;
                    ?>
]" value="<?php 
                    echo htmlspecialchars($owner_id);
                    ?>
">
                                <input type="checkbox" name="used_group_module[<?php 
                    echo $owner_table;
                    ?>
][<?php 
                    echo $group_id;
                    ?>
]" id="groupchk<?php 
                    echo $owner_table . $group_id;
                    ?>
" value="<?php 
                    echo htmlspecialchars($owner_id);
                    ?>
" <?php 
                    echo isset($group_item['checked']) && $group_item['checked'] ? ' checked' : '';
                    ?>
>
                                <?php 
                } else {
                    ?>

                                    <input type="checkbox" name="group" value="<?php 
                    echo htmlspecialchars($owner_id);
                    ?>
" <?php 
                    echo isset($group_item['checked']) && $group_item['checked'] ? ' checked' : '';
                    ?>
 disabled="">
                                <?php 
                }
                ?>

                            </th>
                            <td>
                                <label for="groupchk<?php 
                echo $owner_table . $group_id;
                ?>
"><?php 
                echo htmlspecialchars($group_item['name']);
                ?>
</label>
                            </td>
                        </tr>
                        <?php 
            }
            if ($can_create && module_security::is_page_editable() && get_display_mode() != 'mobile') {
                $group_id = 'new';
                ?>

                    <tr id="group_<?php 
                echo $group_id;
                ?>
">
                        <th class="width1">
                            <input type="hidden" name="group_module[<?php 
                echo $owner_table;
                ?>
][<?php 
                echo $group_id;
                ?>
]" value="<?php 
                echo htmlspecialchars($owner_id);
                ?>
">
                            <input type="checkbox" name="used_group_module[<?php 
                echo $owner_table;
                ?>
][<?php 
                echo $group_id;
                ?>
]" id="groupchk<?php 
                echo $owner_table . $group_id;
                ?>
" value="<?php 
                echo htmlspecialchars($owner_id);
                ?>
">
                        </th>
                        <td>
                            <label for="groupchk<?php 
                echo $owner_table . $group_id;
                ?>
"></label>
                            <input type="text" name="group_module_name[<?php 
                echo $owner_table;
                ?>
][<?php 
                echo $group_id;
                ?>
]" autocomplete="off">
                        </td>
                    </tr>
                    <?php 
            }
            ?>

                </tbody>
            </table>
            <?php 
            //</div>
            $fieldset_data['elements_before'] = ob_get_clean();
            echo module_form::generate_fieldset($fieldset_data);
        }
        //print $html;
    }
Ejemplo n.º 7
0
                    
                    <?php 
if ($invoice_id && $invoice_id != 'new') {
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this invoice.
    // display all the notes which are owned by all the sites we have access to
    module_note::display_notes(array('title' => 'Credit Note Notes', 'owner_table' => 'invoice', 'owner_id' => $invoice_id, 'view_link' => module_invoice::link_open($invoice_id), 'public' => array('enabled' => true, 'title' => 'Public', 'text' => 'Yes, show this note in invoice', 'help' => 'If this is ticked then this note will be available to the customer and will be included in the {INVOICE_NOTES} shortcode in the invoice template.')));
    if (module_job::can_i('edit', 'Invoices')) {
        module_email::display_emails(array('title' => 'Credit Note Emails', 'search' => array('invoice_id' => $invoice_id)));
    }
}
?>


                    <?php 
if ((int) $invoice_id > 0 && (!$invoice['date_sent'] || $invoice['date_sent'] == '0000-00-00') && module_security::is_page_editable()) {
    ?>


                    <h3 class="error_text"><?php 
    _e('Send Credit Note');
    ?>
</h3>
                        <div class="tableclass_form content">

                            <p style="text-align: center;">
                                <input type="submit" name="butt_email" id="butt_email2" value="<?php 
    echo _l('Email Invoice');
    ?>
" class="submit_button" />
                                <?php 
Ejemplo n.º 8
0
    }
    //print_heading($heading);
    $company_fields = array();
    $companys = module_company::get_companys();
    foreach ($companys as $company) {
        $company_fields[] = array('type' => 'hidden', 'name' => "available_vendor_company[" . $company['company_id'] . "]", 'value' => 1);
        $company_fields[] = array('type' => 'check', 'name' => "vendor_company[" . $company['company_id'] . "]", 'value' => $company['company_id'], 'checked' => isset($vendor['company_ids'][$company['company_id']]) || !$vendor_id && !module_company::can_i('edit', 'Company'), 'label' => htmlspecialchars($company['name']));
    }
    $fieldset_data = array('heading' => $heading, 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('company' => array('title' => _l('Company'), 'fields' => $company_fields)));
    echo module_form::generate_fieldset($fieldset_data);
}
/** VENDOR INFORMATION **/
$fieldset_data = array('heading' => array('type' => 'h3', 'title' => $page_type_single . ' Information'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('name' => array('title' => _l('Name'), 'field' => array('type' => 'text', 'name' => 'vendor_name', 'value' => $vendor['vendor_name']))), 'extra_settings' => array('owner_table' => 'vendor', 'owner_key' => 'vendor_id', 'owner_id' => $vendor_id, 'layout' => 'table_row', 'allow_new' => module_vendor::can_i('create', $page_type), 'allow_edit' => module_vendor::can_i('create', $page_type)));
if ($vendor_id && $vendor_id != 'new' && class_exists('module_file') && module_file::is_plugin_enabled()) {
    ob_start();
    module_file::display_files(array('owner_table' => 'vendor', 'owner_id' => $vendor_id, 'layout' => 'gallery', 'editable' => module_security::is_page_editable()));
    $fieldset_data['elements']['logo'] = array('title' => _l('Logo'), 'field' => ob_get_clean());
}
echo module_form::generate_fieldset($fieldset_data);
/** PRIMARY CONTACT DETAILS **/
// we use the "user" module to find the user details
// for the currently selected primary contact id
if ($vendor['primary_user_id']) {
    if (!module_user::can_i('view', 'All ' . $page_type_single . ' Contacts', 'Vendor', 'vendor') && $vendor['primary_user_id'] != module_security::get_loggedin_id()) {
        ob_start();
        echo '<div class="content_box_wheader"><table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_form"><tbody><tr><td>';
        _e('Details hidden');
        echo '</td></tr></tbody></table></div>';
        $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Primary Contact Details'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements_before' => ob_get_clean());
        if ($vendor['primary_user_id']) {
            $fieldset_data['heading']['button'] = array('title' => 'More', 'url' => module_user::link_open_contact($vendor['primary_user_id'], false));
Ejemplo n.º 9
0
             if (isset($h['from_next_due_date']) && $h['from_next_due_date'] && $h['from_next_due_date'] != '0000-00-00' && isset($members_subscriptions[$subscription['subscription_id']]) && isset($members_subscriptions[$subscription['subscription_id']]['next_due_date']) && $members_subscriptions[$subscription['subscription_id']]['next_due_date'] != '0000-00-00' && print_date($members_subscriptions[$subscription['subscription_id']]['next_due_date']) == print_date($h['from_next_due_date'])) {
                 // this invoice is for the next due date (calculated using the new method of storing date in db)
                 $next_due_time_invoice_created = $invoice_data;
             } else {
                 if (print_date($next_due_time) == print_date($invoice_data['date_create']) || $next_due_time_pre && print_date($next_due_time_pre) == print_date($invoice_data['date_create'])) {
                     // this invoice is for the next due date.
                     $next_due_time_invoice_created = $invoice_data;
                 }
             }
             $invoice_history_html .= '<li>';
             $invoice_history_html .= _l('Invoice #%s for %s on %s (paid on %s)', module_invoice::link_open($h['invoice_id'], true, $invoice_data), dollar($invoice_data['total_amount'], true, $invoice_data['currency_id']), print_date($invoice_data['date_create']), $invoice_data['date_paid'] != '0000-00-00' ? print_date($invoice_data['date_paid']) : '<span class="important">' . _l('UNPAID') . '</span>');
             $invoice_history_html .= '</li>';
         }
     }
 }
 if (isset($members_subscriptions[$subscription['subscription_id']]) && module_security::is_page_editable() && $remaining_invoices != 0) {
     //echo '<li>';
     if ($next_due_time_invoice_created) {
         _e('The next invoice has been created for %s. Please mark it as paid.', '<a href="' . module_invoice::link_open($next_due_time_invoice_created['invoice_id'], false, $next_due_time_invoice_created) . '">' . print_date($next_due_time) . '</a>');
         echo ' <a href="#" onclick="$(\'#next_invoice_' . $subscription['subscription_id'] . '\').show(); $(this).hide();">New</a>';
         echo '<span id="next_invoice_' . $subscription['subscription_id'] . '" style="display:none;"><br/>';
     }
     if (isset($subscription['automatic_renew']) && $subscription['automatic_renew']) {
         _e('This Subscription will renew on %s', print_date($next_due_time_pre ? $next_due_time_pre : $next_due_time));
         echo ' ';
         if (isset($subscription['automatic_email']) && $subscription['automatic_email']) {
             _e('and will be automatically emailed');
         }
     } else {
         _e('New Invoice for');
         ?>
Ejemplo n.º 10
0
    $fieldset_data['elements'][] = array('title' => 'Linked Staff', 'fields' => array(function () use(&$finance, $locked, $linked_staff_members) {
        ?>
 <input type="hidden" name="job_staff_expense" value="<?php 
        echo isset($finance['job_staff_expense']) ? (int) $finance['job_staff_expense'] : '';
        ?>
">
                    <?php 
        echo print_select_box($linked_staff_members, 'user_id', isset($finance['user_id']) ? $finance['user_id'] : 0, '', _l(' - None - '));
        if (isset($finance['user_id']) && $finance['user_id']) {
            echo ' <a href="' . module_user::link_open($finance['user_id'], false) . '">' . _l('Open User') . '</a>';
        }
    }));
}
$fieldset_data['elements'][] = array('title' => 'Attachment', 'fields' => array(function () use(&$finance, $locked, $finance_id) {
    if ((int) $finance_id > 0) {
        module_file::display_files(array('owner_table' => 'finance', 'owner_id' => $finance_id, 'layout' => 'gallery', 'editable' => module_security::is_page_editable() && module_finance::can_i('edit', 'Finance')));
    } else {
        _e('Please press save first');
    }
}));
echo module_form::generate_fieldset($fieldset_data);
unset($fieldset_data);
$form_actions = array('class' => 'action_bar action_bar_left', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save_return', 'value' => _l('Save and Return')), array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save'))));
if ((int) $finance_recurring_id > 0 && isset($_SESSION['_finance_recurring_ids'])) {
    // find if there is a next recurring id
    $next = 0;
    foreach ($_SESSION['_finance_recurring_ids'] as $next_data) {
        if ($next == -1) {
            $next = 1;
            // done.
            $form_actions['elements'][] = array('type' => 'hidden', 'name' => 'recurring_next', 'id' => 'recurring_next', 'value' => '');