예제 #1
0
                                    </td>
                                    <?php 
        if ($show_task_dates) {
            ?>

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

                                    <td colspan="2">
                                        <?php 
        $types = module_job::get_task_types();
        $types['-1'] = _l('Default (%s)', $types[$invoice['default_task_type']]);
        module_form::generate_form_element(array('type' => 'select', 'name' => 'invoice_invoice_item[' . $invoice_item_id . '][manual_task_type]', 'id' => 'manual_task_type_' . $invoice_item_id, 'options' => $types, 'blank' => false, 'value' => $invoice_item_data['manual_task_type_real']));
        ?>

                                    </td>
                                    <td colspan="2">
                                        <input type="hidden" name="invoice_invoice_item[<?php 
        echo $invoice_item_id;
        ?>
][taxable_t]" value="1">
                                        <input type="checkbox" name="invoice_invoice_item[<?php 
        echo $invoice_item_id;
        ?>
][taxable]" id="invoice_taxable_item_<?php 
        echo $invoice_item_id;
        ?>
" value="1" <?php 
예제 #2
0
                    <td>
                        <?php 
    if (file_exists('includes/plugin_invoice/pages/invoice_recurring.php')) {
        ?>

                        <input type="text" name="date_renew" class="date_field" value="<?php 
        echo print_date($job['date_renew']);
        ?>
">
                        <br/>
                        <?php 
        $element = array('type' => 'checkbox', 'name' => 'renew_auto', 'value' => isset($job['renew_auto']) && $job['renew_auto'], 'label' => 'Automatically Renew', 'help' => 'This Job will be automatically renewed on this date. A new Job will be created as a copy from this Job.');
        module_form::generate_form_element($element);
        echo '<br/>';
        $element = array('type' => 'checkbox', 'name' => 'renew_invoice', 'value' => isset($job['renew_invoice']) && $job['renew_invoice'], 'label' => 'Automatically Invoice', 'help' => 'When this Job is renewed the tasks will be automatically completed and an invoice will be automatically created and emailed to the customer.');
        module_form::generate_form_element($element);
    } else {
        ?>

                            (recurring jobs available in <a href="http://codecanyon.net/item/ultimate-client-manager-pro-edition/2621629?ref=dtbaker" target="_blank">UCM Pro Edition</a>)
                            <?php 
    }
    ?>

                    </td>

                    <tr>
                        <th>
                            <?php 
    _e('Task Type');
    ?>
예제 #3
0
    public static function print_search_bar($owner_table, $options = array())
    {
        // let the themes override this search bar function.
        if (self::can_i('view', 'Extra Fields')) {
            $result = hook_handle_callback('extra_fields_search_bar', $owner_table, $options);
            if (is_array($result)) {
                // has been handed by a theme.
                echo current($result);
            } else {
                $defaults = self::get_defaults($owner_table);
                $searchable_fields = array();
                foreach ($defaults as $default) {
                    if (isset($default['searchable']) && $default['searchable']) {
                        $searchable_fields[$default['key']] = $default;
                    }
                }
                foreach ($searchable_fields as $searchable_field) {
                    ?>

                    <td class="search_title">
                        <?php 
                    echo htmlspecialchars($searchable_field['key']);
                    ?>
:
                    </td>
                    <td class="search_input">
                        <?php 
                    module_form::generate_form_element(array('type' => 'text', 'name' => 'search[extra_fields][' . htmlspecialchars($searchable_field['key']) . ']'));
                    ?>

                    </td>
                    <?php 
                }
            }
        }
    }
예제 #4
0
파일: data.php 프로젝트: sgh1986915/php-crm
    function get_form_element($element, $viewing_revision = false, $data_record = array())
    {
        $has_write_access = !$viewing_revision;
        // convert our data field to an element.
        $element['name'] = isset($element['name']) && !empty($element['name']) ? $element['name'] : 'data_field[' . $element['data_field_id'] . ']';
        $element['id'] = 'data_field_' . $element['data_field_id'] . '';
        $element['type'] = $element['field_type'];
        if (!isset($element['value'])) {
            $element['value'] = '';
        }
        if (!$has_write_access) {
            //$element['disabled'] = 'disabled';
            $element['class'] = 'data_field_view';
        }
        $highlight = false;
        $this->ajax_edit = false;
        $input_name = $element['name'];
        if (!$input_name) {
            return false;
        }
        if (isset($element['id']) && $element['id']) {
            $input_id = $element['id'];
        } else {
            $element['id'] = $input_name;
            $input_id = $input_name;
        }
        //if(!$value && isset($_REQUEST[$input_name]))$value = $_REQUEST[$input_name];
        if (!$element['value']) {
            $element['value'] = $element['default'];
        }
        if (!is_array($element['value'])) {
            //$value=htmlspecialchars($value);
        }
        if (!isset($element['class'])) {
            $element['class'] = '';
        }
        $attr = $attr_other = '';
        if ($has_write_access) {
            if ($element['type'] == 'radio' || $element['type'] == 'checkbox_list') {
                // hacky!
                if ($element['required']) {
                    $attr_other .= ' class="form_field form_field_required"';
                } else {
                    $attr_other .= ' class="form_field"';
                }
            } else {
                $element['class'] .= " form_field";
                if ($element['required']) {
                    $element['class'] .= " form_field_required";
                }
            }
            switch ($element['type']) {
                case 'date':
                    $element['class'] .= " date_field";
                    if (!isset($element['size']) || !$element['size']) {
                        $element['size'] = 8;
                    }
                    if (strtolower($element['value']) == 'now') {
                        $element['value'] = print_date(time());
                    }
                    break;
                case 'datetime':
                    $element['class'] .= " date_time_field";
                    if (!isset($element['size']) || !$element['size']) {
                        $element['size'] = 12;
                    }
                    if (strtolower($element['value']) == 'now') {
                        $element['value'] = print_date(time(), true);
                    }
                    break;
            }
        }
        switch ($element['type']) {
            case 'checkbox_list':
            case 'radio':
                $element['attributes'] = array();
                foreach (explode("\n", trim($element['field_data'])) as $line) {
                    $line = trim($line);
                    if (preg_match('/^attributes=/', $line)) {
                        $line = preg_replace('/^attributes=/', '', $line);
                        $element['attributes'] = explode("|", $line);
                        break;
                    }
                }
                break;
            case 'select':
                if (!isset($element['attributes']) || !is_array($element['attributes']) || !count($element['attributes'])) {
                    $element['attributes'] = array();
                    foreach (explode("\n", trim($element['field_data'])) as $line) {
                        $line = trim($line);
                        if (preg_match('/^attributes=/', $line)) {
                            $line = preg_replace('/^attributes=/', '', $line);
                            if (preg_match('#hook:([\\w_]+)$#', $line, $matches)) {
                                // see if we get anything back from this hook.
                                $attributes = array();
                                $attributes = hook_filter_var($matches[1], $attributes, $element);
                                if (is_array($attributes)) {
                                    $element['attributes'] = $attributes;
                                } else {
                                    $element['attributes'] = array('Unable to call hook: ' . $matches[1]);
                                }
                            } else {
                                $element['attributes'] = explode("|", $line);
                            }
                            break;
                        }
                    }
                }
                break;
        }
        if (!isset($element['style'])) {
            $element['style'] = '';
        }
        // we have to apply some custom width/height styles if they exist.
        $width = $height = false;
        foreach (explode("\n", trim($element['field_data'])) as $line) {
            $line = trim($line);
            if (preg_match('/^width=/', $line)) {
                $line = preg_replace('/^width=/', '', $line);
                $width = (int) $line;
            }
            if (preg_match('/^height=/', $line)) {
                $line = preg_replace('/^height=/', '', $line);
                $height = (int) $line;
            }
        }
        if (!$height && $height < _MIN_INPUT_HEIGHT) {
            $height = _MIN_INPUT_HEIGHT;
        }
        switch ($element['type']) {
            case 'text':
            case 'date':
            case 'datetime':
                if ($width) {
                    $element['style'] .= 'width:' . $width . 'px; ';
                }
                break;
            case 'radio':
                if ($width) {
                    $attr_other .= ' style="width:' . $width . 'px; "';
                }
                break;
            case 'textarea':
            case 'textbox':
                if ($width) {
                    $element['style'] .= 'width:' . $width . 'px; ';
                }
                if ($has_write_access && $height) {
                    $element['style'] .= 'height:' . $height . 'px; ';
                }
                break;
        }
        if (isset($element['width'])) {
            unset($element['width']);
        }
        if (isset($element['height'])) {
            unset($element['height']);
        }
        if (isset($element['multiple']) && $element['multiple']) {
            $element['multiple'] = true;
            // pass 'multiple' through to the UCM form builder which should handle everything
            $value_unserialize = @unserialize($element['value']);
            if (is_array($value_unserialize)) {
                $element['values'] = $value_unserialize;
                // 'values' is used in the UCM field generation tool
            }
            $element['name'] = $element['name'] . '[]';
        } else {
            $element['multiple'] = false;
        }
        if (!$has_write_access && $element['multiple'] && isset($element['values']) && is_array($element['values'])) {
            $element['value'] = $element['values'];
        }
        if (is_array($element['value']) && count($element['value'])) {
            $all_values = $element['value'];
        } else {
            $all_values = array($element['value']);
        }
        if ($element['type'] == 'checkbox_list') {
            $test = @unserialize($element['value']);
            if (is_array($test) && count($test)) {
                $all_values = array($test);
            } else {
                $all_values = array($element['value']);
            }
        }
        if ($element['type'] == "cancel" && !isset($element['onclick'])) {
            $element['onclick'] = "history.go(-1);";
        }
        if ($highlight) {
            $element['class'] .= " form_field_highlight";
        }
        /*if(!$has_write_access){
        			$element['class'] .= ' form_disabled';
        		}*/
        $attribute_keys = array('class', 'disabled', 'onclick', 'onfocus', 'onmouseup', 'onmousedown', 'onchange', 'size', 'cols', 'rows', 'width', 'style');
        foreach ($element as $key => $val) {
            if (!is_array($val) && !trim($val)) {
                continue;
            }
            if (in_array(strtolower($key), $attribute_keys)) {
                if (in_array(strtolower($key), array('size', 'cols', 'rows', 'width', 'height')) && (int) $val == 0) {
                    continue;
                }
                $attr .= ' ' . $key . '="' . $val . '"';
            }
        }
        // check for default values, these are cleared when submitting the form
        if ($element['default']) {
            $has_default = true;
        }
        $real_input_id = $input_id;
        $real_input_name = $input_name;
        ob_start();
        foreach ($all_values as $value_key => $value) {
            if (!$has_write_access) {
                // disabled.
                if (isset($width) && $width && $element['type'] != 'encrypted') {
                    echo '<span ' . $attr;
                    echo ' style="width:' . $width . 'px;"';
                    echo '>&nbsp;';
                }
                // display value differently depending on value type.
                switch ($element['type']) {
                    case 'checkbox_list':
                        $other = '';
                        if (is_array($value)) {
                            if (isset($value['other_val'])) {
                                $other = $value['other_val'];
                                unset($value['other_val']);
                            }
                            echo implode(', ', array_keys($value));
                        }
                        echo ' ' . $other;
                        break;
                    case 'select':
                        if (isset($element['attributes'])) {
                            $attributes = $element['attributes'];
                        } else {
                            $attributes = array();
                        }
                        if (isset($attributes[0])) {
                            $new_attributes = array();
                            foreach ($attributes as $aid => $a) {
                                $new_attributes[$aid + 1] = $a;
                            }
                            $attributes = $new_attributes;
                        }
                        if (isset($attributes[$value])) {
                            echo $attributes[$value];
                        }
                        break;
                    case 'textarea':
                    case 'textbox':
                        echo nl2br(htmlspecialchars($value));
                        break;
                    case 'file':
                        if ($value) {
                            $file_data = @unserialize($value);
                            $file_link = 'includes/plugin_data/upload/' . $file_data['file'];
                            if (is_file($file_link)) {
                                $download_link = self::link_public_file_download($data_record['data_record_id'], $data_record['data_type_id'], $element['data_field_group_id'], $element['data_field_id']);
                                echo '<a href="' . $download_link . '" target="_blank">' . $file_data['name'] . '</a>';
                            } else {
                                echo 'File Not Found';
                            }
                        }
                        break;
                    case 'wysiwyg':
                        echo module_security::purify_html($value);
                        break;
                    case 'encrypted':
                        if (class_exists('module_encrypt', false)) {
                            ob_start();
                            $element['type'] = 'text';
                            module_form::generate_form_element($element);
                            $enc_html = ob_get_clean();
                            echo module_encrypt::parse_html_input('custom_data', $enc_html, false);
                        }
                        break;
                    case 'created_date_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A');
                        break;
                    case 'created_date':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A');
                        break;
                    case 'created_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A');
                        break;
                    case 'updated_date_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], true) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A'));
                        break;
                    case 'updated_date':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], false) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A'));
                        break;
                    case 'updated_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_updated'])) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A'));
                        break;
                    case 'created_by':
                        echo isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A');
                        break;
                    case 'updated_by':
                        echo isset($data_record['update_user_id']) && (int) $data_record['update_user_id'] > 0 ? module_user::link_open($data_record['update_user_id'], true) : (isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A'));
                        break;
                    case 'url':
                        echo '<a href="' . htmlspecialchars($value) . '" target="_blank">' . htmlspecialchars($value) . '</a>';
                        break;
                    default:
                        echo htmlspecialchars($value);
                        break;
                }
                if (isset($width) && $width && $element['type'] != 'encrypted') {
                    echo '&nbsp;</span>';
                }
            } else {
                // update for UCM: use the ucm form generator
                if (isset($element['default']) && $element['default'] && !$element['value']) {
                    $element['value'] = $element['default'];
                }
                switch ($element['type']) {
                    case 'wysiwyg':
                        $element['options']['inline'] = false;
                        module_form::generate_form_element($element);
                        break;
                    case "radio":
                        $has_val = false;
                        foreach ($element['attributes'] as $attribute) {
                            $this_input_id = $input_id . preg_replace('/[^a-zA-Z]/', '', $attribute);
                            ?>

                            <span class="field_radio">
                            <input type="radio" name="<?php 
                            echo $input_name;
                            ?>
" id="<?php 
                            echo $this_input_id;
                            ?>
" value="<?php 
                            echo htmlspecialchars($attribute);
                            ?>
"<?php 
                            if ($attribute == $value || strtolower($attribute) == 'other' && !$has_val) {
                                // assumes "OTHER" is always last... fix with a separate loop before hand checking all vals
                                if (strtolower($attribute) != 'other') {
                                    $has_val = true;
                                }
                                echo " checked";
                            }
                            echo ' ' . $attr;
                            if (strtolower($attribute) == 'other') {
                                echo ' onmouseup="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                                echo ' onchange="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                            }
                            ?>
>
                                <label for="<?php 
                            echo $this_input_id;
                            ?>
"><?php 
                            echo $attribute;
                            ?>
</label>
                                <?php 
                            if (strtolower($attribute) == 'other') {
                                ?>

                                    <span class="data_field_input">
                                    <input type="text" name="other_<?php 
                                echo $input_name;
                                ?>
" id="other_<?php 
                                echo $this_input_id;
                                ?>
" value="<?php 
                                if (!$has_val) {
                                    echo htmlspecialchars($value);
                                }
                                ?>
" onchange="$('input[type=radio]',$(this).parent())[0].checked = true;" <?php 
                                echo $attr . $attr_other;
                                ?>
>
                                    </span>
                                <?php 
                            }
                            ?>

                            </span>
                            <?php 
                        }
                        break;
                    case "checkbox_list":
                        $has_val = false;
                        if (!is_array($value)) {
                            $value = array();
                        }
                        foreach ($element['attributes'] as $attribute) {
                            $this_input_id = $input_id . preg_replace('/[^a-zA-Z]/', '', $attribute);
                            ?>

                            <span class="field_radio">
                            <input type="checkbox" name="<?php 
                            echo $input_name;
                            ?>
[<?php 
                            echo htmlspecialchars($attribute);
                            ?>
]" id="<?php 
                            echo $this_input_id;
                            ?>
" value="1"<?php 
                            if (isset($value[$attribute])) {
                                if (strtolower($attribute) != 'other') {
                                    $has_val = true;
                                }
                                echo " checked";
                            }
                            echo ' ' . $attr;
                            if (strtolower($attribute) == 'other') {
                                echo ' onmouseup="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                                echo ' onchange="if(this.checked)$(\'#other_' . $this_input_id . '\')[0].focus();"';
                            }
                            ?>
>
                                <label for="<?php 
                            echo $this_input_id;
                            ?>
"><?php 
                            echo $attribute;
                            ?>
</label>
                                <?php 
                            if (strtolower($attribute) == 'other') {
                                ?>

                                    <span class="data_field_input">
                                        <input type="text" name="<?php 
                                echo $input_name;
                                ?>
[other_val]" id="other_<?php 
                                echo $this_input_id;
                                ?>
" value="<?php 
                                echo isset($value['other_val']) ? htmlspecialchars($value['other_val']) : '';
                                ?>
" onchange="$('input[type=radio]',$(this).parent())[0].checked = true;" <?php 
                                echo $attr . $attr_other;
                                ?>
>
                                    </span>
                                <?php 
                            }
                            ?>

                            </span>
                            <?php 
                        }
                        break;
                    case "file":
                        $this->has_files = true;
                        ?>

                        <input type="file" name="<?php 
                        echo $input_name;
                        ?>
" id="<?php 
                        echo $input_id;
                        ?>
" value="<?php 
                        echo $value;
                        ?>
"<?php 
                        echo $attr;
                        ?>
>
                        <?php 
                        break;
                    case 'select':
                        $attributes = isset($element['attributes']) ? $element['attributes'] : array();
                        if (isset($attributes[0])) {
                            $new_attributes = array();
                            foreach ($attributes as $aid => $a) {
                                $new_attributes[$aid + 1] = $a;
                            }
                            $attributes = $new_attributes;
                        }
                        $element['options'] = $attributes;
                        module_form::generate_form_element($element);
                        break;
                    case 'encrypted':
                        if (class_exists('module_encrypt', false)) {
                            ob_start();
                            $element['type'] = 'text';
                            module_form::generate_form_element($element);
                            $enc_html = ob_get_clean();
                            echo module_encrypt::parse_html_input('custom_data', $enc_html);
                        }
                        break;
                    case 'created_date_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A');
                        break;
                    case 'created_date':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A');
                        break;
                    case 'created_time':
                        echo isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A');
                        break;
                    case 'updated_date_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], true) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], true) : _l('N/A'));
                        break;
                    case 'updated_date':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? print_date($data_record['date_updated'], false) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? print_date($data_record['date_created'], false) : _l('N/A'));
                        break;
                    case 'updated_time':
                        echo isset($data_record['date_updated']) && $data_record['date_updated'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_updated'])) : (isset($data_record['date_created']) && $data_record['date_created'] != '0000-00-00 00:00:00' ? date(module_config::c('time_format', 'g:ia'), strtotime($data_record['date_created'])) : _l('N/A'));
                        break;
                    case 'created_by':
                        echo isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A');
                        break;
                    case 'updated_by':
                        echo isset($data_record['update_user_id']) && (int) $data_record['update_user_id'] > 0 ? module_user::link_open($data_record['update_user_id'], true) : (isset($data_record['create_user_id']) && (int) $data_record['create_user_id'] > 0 ? module_user::link_open($data_record['create_user_id'], true) : _l('N/A'));
                        break;
                    case 'url':
                        $element['type'] = 'text';
                        module_form::generate_form_element($element);
                        break;
                    default:
                        module_form::generate_form_element($element);
                }
                if (isset($element['after_link']) && $element['after_link']) {
                    if (preg_match('/^https?:\\/\\//', $value) || ($have_www = preg_match('/^www\\./', $value) || ($have_www = preg_match('/\\.com/', $value) && !preg_match('/\\w@\\w/', $value)))) {
                        // we have a url
                        if ($have_www) {
                            $value = "http://" . $value;
                        }
                        ?>

						<a href="<?php 
                        echo $value;
                        ?>
" target="_blank">&raquo;</a>
						<?php 
                    }
                    if (preg_match('/\\w@\\w/', $value)) {
                        ?>

						<a href="mailto:<?php 
                        echo $value;
                        ?>
">&raquo;</a>
					<?php 
                    }
                }
            }
            // editable
            echo '&nbsp;';
        }
        // foreach all values
        //${$element_id} = ob_get_clean();
        // we just print the html for now
        return ob_get_clean();
    }
예제 #5
0
             <input type="file" name="csv">
         </td>
     </tr>
     <?php 
 if (isset($import_options['options']) && is_array($import_options['options'])) {
     foreach ($import_options['options'] as $option_id => $option_values) {
         ?>
         <tr>
             <th>
                 <?php 
         echo $option_values['label'];
         ?>
             </th>
             <td>
                 <?php 
         module_form::generate_form_element($option_values['form_element']);
         ?>
             </td>
         </tr>
         <?php 
     }
 }
 ?>
     <?php 
 if (class_exists('module_group', false) && isset($import_options['group']) && $import_options['group']) {
     // hack to support multiple groups (for members)
     if (!is_array($import_options['group'])) {
         $import_options['group'] = array($import_options['group']);
     }
     foreach ($import_options['group'] as $group_option) {
         ?>
예제 #6
0
function metis_generate_form_actions($callback, $options)
{
    $defaults = array('type' => 'action_bar', 'class' => 'action_bar', 'elements' => array());
    $options = array_merge($defaults, $options);
    //todo - hook in here for themes.
    ob_start();
    ?>
        <div class="action_bar_duplicate <?php 
    echo $options['class'];
    ?>
">
            <?php 
    foreach ($options['elements'] as $element) {
        if (is_array($element) && !is_array(current($element))) {
            $element = array($element);
        }
        $element['fields'] = $element;
        ?>
                <span class="action">
                    <?php 
        if (isset($element['fields'])) {
            ?>
                    <span class="action_element">
                        <?php 
            if (is_array($element['fields'])) {
                foreach ($element['fields'] as $dataid => $field) {
                    if (is_array($field)) {
                        // treat this as a call to the form generate option
                        switch ($field['type']) {
                            case 'save_button':
                                $field['type'] = 'submit';
                                $field['class'] = (isset($field['class']) ? $field['class'] . ' ' : '') . 'submit_button btn btn-success';
                                break;
                            case 'submit':
                                $field['type'] = 'submit';
                                $field['class'] = (isset($field['class']) ? $field['class'] . ' ' : '') . 'submit_button btn btn-default';
                                break;
                            case 'delete_button':
                                $field['type'] = 'submit';
                                $field['class'] = (isset($field['class']) ? $field['class'] . ' ' : '') . 'submit_button btn btn-danger';
                                break;
                            case 'button':
                                $field['type'] = 'button';
                                $field['class'] = (isset($field['class']) ? $field['class'] . ' ' : '') . 'submit_button btn btn-default';
                                break;
                        }
                        module_form::generate_form_element($field);
                        echo ' ';
                    } else {
                        echo $field . ' ';
                    }
                }
            } else {
                echo $element['fields'];
            }
            ?>
                    </span>
                <?php 
        }
        ?>
                </span>
            <?php 
    }
    ?>
        </div>
        <?php 
    return ob_get_clean();
}
예제 #7
0
    public static function display_pagination_hook()
    {
        if (isset(self::$pagination_options['fields'])) {
            $owner_table = (string) self::$pagination_options['fields']['owner_table'];
            global $plugins;
            if (isset($plugins[$owner_table]) && isset(self::$pagination_options['fields']['title']) && self::$pagination_options['fields']['title']) {
                $can_view = $plugins[$owner_table]->can_i('view', self::$pagination_options['fields']['title']);
                if (!$can_view) {
                    return '';
                }
                /*$can_edit = $plugins[$owner_table]->can_i('edit',self::$pagination_options['fields']['title']);
                  $can_create = $plugins[$owner_table]->can_i('create',self::$pagination_options['fields']['title']);
                  $can_delete = $plugins[$owner_table]->can_i('delete',self::$pagination_options['fields']['title']);*/
            }
            ?>

            <span>
            <a href="#" onclick="if($('#group_popdown').css('display')=='inline' || $('#group_popdown').css('display')=='block') $('#group_popdown').css('display','none'); else $('#group_popdown').css('display','inline'); return false;"><?php 
            _e('(group)');
            ?>
</a>
            <span id="group_popdown" style="position: absolute; width: 200px; display: none; background: #EFEFEF; margin-left: -210px; margin-top: 30px; border: 1px solid #CCC; text-align: left; padding: 6px; z-index: 3;">
                <strong><?php 
            _e('Add all these results to a group:');
            ?>
</strong><br/>
                <?php 
            $groups = self::get_groups(trim((string) self::$pagination_options['fields']['owner_table']));
            if (!count($groups)) {
                _e('Sorry, no groups exist. Please create a group first.');
            } else {
                foreach ($groups as $group) {
                    $group_id = $group['group_id'];
                    ?>

                        <input type="checkbox" class="add_to_group" name="add_to_group[<?php 
                    echo $group['group_id'];
                    ?>
]" id="groupchk<?php 
                    echo $group_id;
                    ?>
" value="yes">
                        <label for="groupchk<?php 
                    echo $group_id;
                    ?>
"><?php 
                    echo htmlspecialchars($group['name']);
                    ?>
</label> <br/>
                        <?php 
                }
                ?>

                    <input type="hidden" name="add_group_go" id="add_group_go" value="">
                    <input type="button" name="add_group_button" id="add_group_button" value="<?php 
                _e('Add to group');
                ?>
">
                    <script type="text/javascript">
                        $(function(){
                            $('#add_group_button').click(function(){
                                $('#add_group_go').val('yes');
                                // todo: if no form, create one them submit.
                                $('#add_group_go').parents('form')[0].submit();
                            });
                        });
                    </script>
                <?php 
            }
            ?>

            </span>
            </span>
        <?php 
        }
        if (isset(self::$pagination_options['bulk_actions']) && count(self::$pagination_options['bulk_actions'])) {
            ?>

        <span>
            <a href="#" onclick="if($('#bulk_popdown').css('display')=='inline' || $('#bulk_popdown').css('display')=='block') $('#bulk_popdown').css('display','none'); else $('#bulk_popdown').css('display','inline'); return false;"><?php 
            _e('(bulk actions)');
            ?>
</a>
            <span id="bulk_popdown" style="position: absolute; width: 200px; display: none; background: #EFEFEF; margin-left: -210px; margin-top: 30px; border: 1px solid #CCC; text-align: left; padding: 6px; z-index: 3;">
                <strong><?php 
            _e('Bulk actions:');
            ?>
</strong><br/>
                <?php 
            foreach (self::$pagination_options['bulk_actions'] as $bulk_action_id => $bulk_action_data) {
                switch ($bulk_action_data['type']) {
                    case 'delete':
                        ?>

                                    <input type="checkbox" class="bulk_action" name="bulk_action[<?php 
                        echo $bulk_action_id;
                        ?>
]" id="bulkchk<?php 
                        echo $bulk_action_id;
                        ?>
" value="yes">
                                    <label for="bulkchk<?php 
                        echo $bulk_action_id;
                        ?>
"><?php 
                        _e($bulk_action_data['label']);
                        ?>
</label> <br/>
                                <?php 
                        break;
                    case 'form':
                        ?>

                                    <input type="checkbox" class="bulk_action" name="bulk_action[<?php 
                        echo $bulk_action_id;
                        ?>
]" id="bulkchk<?php 
                        echo $bulk_action_id;
                        ?>
" value="yes">
                                    <label for="bulkchk<?php 
                        echo $bulk_action_id;
                        ?>
"><?php 
                        _e($bulk_action_data['label']);
                        ?>
</label>
	                                <?php 
                        if (isset($bulk_action_data['elements'])) {
                            foreach ($bulk_action_data['elements'] as $element) {
                                module_form::generate_form_element($element);
                            }
                        }
                        ?>
<br/>
                                <?php 
                        break;
                    default:
                        ?>

                                    <input type="checkbox" class="bulk_action" name="bulk_action[<?php 
                        echo $bulk_action_id;
                        ?>
]" id="bulkchk<?php 
                        echo $bulk_action_id;
                        ?>
" value="yes">
                                    <label for="bulkchk<?php 
                        echo $bulk_action_id;
                        ?>
"><?php 
                        _e($bulk_action_data['label']);
                        ?>
</label> <br/>
                                <?php 
                        break;
                }
                ?>


                        <?php 
            }
            ?>

                    <input type="hidden" name="bulk_action_go" id="bulk_action_go" value="">
                    <input type="button" name="bulk_action_button" id="bulk_action_button" value="<?php 
            _e('Perform Bulk Actions');
            ?>
">
                    <script type="text/javascript">
                        $(function(){
                            $('#bulk_action_button').click(function(){
                                $('#bulk_action_go').val('yes');
                                // todo: if no form, create one them submit.
                                $('#bulk_action_go').parents('form')[0].submit();
                            });
                        });
                    </script>
            </span>
            </span>
        <?php 
        }
    }
예제 #8
0
                                    </td>
                                </tr>
                                    <?php 
        foreach ($extras as $extra) {
            ?>

                                    <tr>
                                        <th nowrap="nowrap">
                                            <?php 
            echo htmlspecialchars($extra['key']);
            ?>

                                        </th>
                                        <td>
                                            <?php 
            module_form::generate_form_element(array('type' => $extra['type'], 'name' => 'ticket_extra[' . $extra['ticket_data_key_id'] . ']', 'value' => isset($_POST['ticket_extra']) && isset($_POST['ticket_extra'][$extra['ticket_data_key_id']]) ? $_POST['ticket_extra'][$extra['ticket_data_key_id']] : '', 'options' => isset($extra['options']) && $extra['options'] ? unserialize($extra['options']) : array()));
            if (class_exists('module_encrypt', false) && module_config::c('ticket_show_encrypt_fields', 1) && isset($extra['encrypt_key_id']) && $extra['encrypt_key_id'] && ($extra['type'] == 'text' || $extra['type'] == 'textarea')) {
                // hack to show the encrypt key icon if this is an encryptable key.
                echo '<img src="' . full_link('includes/plugin_encrypt/images/lock.png') . '" style="vertical-align:top;" border="0">';
                if (module_config::c('ticket_show_encrypt_fields_help_popup', 1)) {
                    _h('This field is encrypted in the database using industry standard RSA cryptography.');
                }
            }
            ?>

                                        </td>
                                    </tr>
                                    <?php 
        }
    }
}
예제 #9
0
    <input type="hidden" name="<?php 
        echo htmlspecialchars($key);
        ?>
" value="<?php 
        echo htmlspecialchars($val);
        ?>
">
    <?php 
    }
}
?>
    <?php 
if (isset($form_data[5]) && is_array($form_data[5]) && isset($form_data[5]['options'])) {
    foreach ($form_data[5]['options'] as $option) {
        echo htmlspecialchars($option['label']);
        module_form::generate_form_element($option);
        echo '<br/>';
    }
    ?>
    <?php 
}
?>

    <input type="hidden" name="really_confirm_delete" id="really_confirm_delete" value="">
    <?php 
$form_actions = array('class' => 'action_bar action_bar_center action_bar_single', 'elements' => array(array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Confirm Delete'), 'onclick' => "\$('#really_confirm_delete').val('yep');"), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $form_data[3] . "'; return false;")));
echo module_form::generate_form_actions($form_actions);
?>
</form>

<?php 
        ?>
");
			        }
			        <?php 
    }
    ?>


		        }
		        function tinymce_blur() {

		        }
	        </script>

	        <?php 
    module_form::generate_form_element(array('type' => 'wysiwyg', 'name' => 'new_ticket_message', 'value' => '', 'options' => array('inline' => false)));
    ?>

	        <table class="tableclass tableclass_full tableclass_form">
		        <tbody>

		        <?php 
    if (module_config::c('ticket_allow_attachment', 1)) {
        ?>

			        <tr>
				        <th>
					        <?php 
        _e('Add Attachment');
        ?>
예제 #11
0
        $extra_summary = array();
        foreach ($extras as $extra) {
            if (isset($ticket['extra_data'][$extra['ticket_data_key_id']]) && $ticket['extra_data'][$extra['ticket_data_key_id']]['value'] && strpos($ticket['extra_data'][$extra['ticket_data_key_id']]['value'], 'encrypt:') === false) {
                $extra_summary[] = $ticket['extra_data'][$extra['ticket_data_key_id']]['value'];
            }
        }
        $fieldset_data = array('heading' => array('title' => _l('Extra Information'), 'type' => 'h3', 'responsive' => array('summary' => implode(', ', $extra_summary))), 'elements' => array());
        foreach ($extras as $extra) {
            $fieldset_data['elements'][] = array('title' => htmlspecialchars($extra['key']), 'fields' => array(function () use($extra, $ticket) {
                // we do a hook in here with the encryption plugin.
                // if some of these fields are marked for encryption we display a nice lock
                // and some stars instead of the value.
                // if there isn't a value then we don't display any stars, just a lock symbol
                // we also have to show an "unlock" button so the admin can unlock the value.
                if (!isset($extras_editable) || $extras_editable) {
                    module_form::generate_form_element(array('type' => $extra['type'], 'name' => 'ticket_extra[' . $extra['ticket_data_key_id'] . ']', 'value' => isset($ticket['extra_data'][$extra['ticket_data_key_id']]) ? $ticket['extra_data'][$extra['ticket_data_key_id']]['value'] : '', 'options' => isset($extra['options']) && $extra['options'] ? unserialize($extra['options']) : array(), 'class' => 'no_permissions', 'encrypt' => class_exists('module_encrypt', false) && isset($extra['encrypt_key_id']) && $extra['encrypt_key_id'], 'page_name' => 'ticket_extras', 'id' => 'ticket_extras_' . $extra['ticket_data_key_id']));
                    if (preg_match('#(https?://[^\\s]*)$#', isset($ticket['extra_data'][$extra['ticket_data_key_id']]) ? $ticket['extra_data'][$extra['ticket_data_key_id']]['value'] : '', $matches)) {
                        ?>
 <a href="<?php 
                        echo htmlspecialchars($matches[1]);
                        ?>
" target="_blank"><?php 
                        _e('Open');
                        ?>
 &raquo;</a> <?php 
                    } else {
                        if (preg_match('#(www\\.[^\\s]*)$#', isset($ticket['extra_data'][$extra['ticket_data_key_id']]) ? $ticket['extra_data'][$extra['ticket_data_key_id']]['value'] : '', $matches)) {
                            ?>
 <a href="http://<?php 
                            echo htmlspecialchars($matches[1]);
                            ?>
예제 #12
0
    /*echo $setting['key'];*/
    ?>
                </td>-->
                <th><?php 
    echo $setting['description'];
    ?>
</th>
                <td>

                    <?php 
    if ($setting['type'] == 'html') {
        echo $setting['html'];
    } else {
        $setting['name'] = 'config[' . $setting['key'] . ']';
        $setting['value'] = module_config::c($setting['key'], $setting['default']);
        module_form::generate_form_element($setting);
    }
    /*switch($setting['type']){
                            case 'number':
                            ?>
                                <input type="text" name="config[<?php echo $setting['key'];?>]" value="<?php echo htmlspecialchars(module_config::c($setting['key'],$setting['default']));?>" size="20">
                                <?php
                            break;
                            case 'text':
                            ?>
                                <input type="text" name="config[<?php echo $setting['key'];?>]" value="<?php echo htmlspecialchars(module_config::c($setting['key'],$setting['default']));?>" size="60">
                                <?php
                            break;
                            case 'textarea':
                            ?>
                                <textarea name="config[<?php echo $setting['key'];?>]" rows="6" cols="50"><?php echo htmlspecialchars(module_config::c($setting['key'],$setting['default']));?></textarea>