本文整理汇总了PHP中field::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP field::delete方法的具体用法?PHP field::delete怎么用?PHP field::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类field
的用法示例。
在下文中一共展示了field::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_rlipexport_version1elis_extrafieldsetcustomfieldbase_handledeleted
/**
* Test that when a custom field is configured, then deleted, the field is removed from configuration.
*/
public function test_rlipexport_version1elis_extrafieldsetcustomfieldbase_handledeleted()
{
$this->load_csv_data();
$fieldid1 = $this->create_custom_field('testcf1', 0, false, CONTEXT_ELIS_USER, 'text');
$this->create_field_mapping('testcustomfields', 'field_' . $fieldid1, 'Field One');
$this->create_field_data($fieldid1, 'Test Text One');
$field = new field($fieldid1);
$field->load();
$field->delete();
$enabledfields = rlipexport_version1elis_extrafields::get_enabled_fields();
$fieldset = new rlipexport_version1elis_extrafieldset_testcustomfields($enabledfields['testcustomfields']);
$columns = $fieldset->get_columns();
$this->assertInternalType('array', $columns);
$this->assertEmpty($columns);
$record = new stdClass();
$data = $fieldset->get_data($record);
$this->assertInternalType('array', $data);
$this->assertEmpty($data);
}
示例2: field
function display_deletefield()
{
global $OUTPUT;
$level = $this->required_param('level', PARAM_ACTION);
$id = $this->required_param('id', PARAM_INT);
$field = new field($id);
if (!$field->id) {
print_error('invalid_field_id', 'local_elisprogram');
}
$confirm = $this->optional_param('confirm', 0, PARAM_INT);
if ($confirm) {
$field->delete();
$tmppage = new customfieldpage(array('level' => $level));
redirect($tmppage->url, get_string('field_deleted', 'local_elisprogram', $field));
} else {
$optionsyes = array('s' => $this->pagename, 'action' => 'deletefield', 'id' => $id, 'confirm' => 1, 'level' => $level);
$optionsno = array('s' => $this->pagename, 'level' => $level);
$buttoncontinue = new single_button(new moodle_url('index.php', $optionsyes), get_string('yes'), 'POST');
$buttoncancel = new single_button(new moodle_url('index.php', $optionsno), get_string('no'), 'GET');
echo $OUTPUT->confirm(get_string('confirm_delete_field', 'local_elisprogram', array('datatype' => $field->datatype, 'name' => $field->name)), $buttoncontinue, $buttoncancel);
}
}
示例3: delete
function delete()
{
global $CURMAN;
$fields = $CURMAN->db->get_records(FIELDTABLE, 'categoryid', $this->id);
if (!empty($fields)) {
foreach ($fields as $field) {
$fieldobj = new field($field);
$fieldobj->delete();
}
}
// delete category context data
$CURMAN->db->delete_records(FIELDCATEGORYCONTEXTTABLE, 'categoryid', $this->id);
// delete field
$CURMAN->db->delete_records(FIELDTABLE, 'categoryid', $this->id);
// delete category
parent::delete();
}
示例4: field
function action_deletefield()
{
$level = $this->required_param('level', PARAM_ACTION);
$id = $this->required_param('id', PARAM_INT);
$field = new field($id);
if (!$field->id) {
print_error('invalidfieldid', 'block_curr_admin');
}
$confirm = $this->optional_param('confirm', 0, PARAM_INT);
if ($confirm) {
$field->delete();
$tmppage = new customfieldpage(array('level' => $level));
redirect($tmppage->get_url(), get_string('field_deleted', 'block_curr_admin', $field));
} else {
notice_yesno(get_string('confirm_delete_field', 'block_curr_admin', $field), 'index.php', 'index.php', array('s' => $this->pagename, 'action' => 'deletefield', 'id' => $id, 'confirm' => 1, 'level' => $level), array('s' => $this->pagename, 'level' => $level), 'POST', 'GET');
}
}