本文整理汇总了PHP中module_security::is_page_editable方法的典型用法代码示例。如果您正苦于以下问题:PHP module_security::is_page_editable方法的具体用法?PHP module_security::is_page_editable怎么用?PHP module_security::is_page_editable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module_security
的用法示例。
在下文中一共展示了module_security::is_page_editable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_note
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
}
});
//.........这里部分代码省略.........
示例2: display_extras
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;
}
}
//.........这里部分代码省略.........
示例3: foreach
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.
示例4: _h
<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);
?>
示例5: foreach
?>
" 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;
示例6: display_groups
//.........这里部分代码省略.........
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;
}
示例7: array
<?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
示例8: array
}
//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));
示例9: _l
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');
?>
示例10: array
$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' => '');