本文整理汇总了PHP中Skin::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::commit方法的具体用法?PHP Skin::commit怎么用?PHP Skin::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::commit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deletefontform_submit
function deletefontform_submit(Pieform $form, $values)
{
global $SESSION;
$fontname = $values['font'];
$result = delete_records('skin_fonts', 'name', $fontname);
if ($result == false) {
$SESSION->add_error_msg(get_string('cantdeletefont', 'skin'));
} else {
// Check to see if the font is being used in a skin. If it is remove it from
// the skin's viewskin data
$skins = get_records_array('skin');
if (is_array($skins)) {
foreach ($skins as $skin) {
$options = unserialize($skin->viewskin);
foreach ($options as $key => $option) {
if (preg_match('/font_family/', $key) && $option == $fontname) {
require_once get_config('docroot') . 'lib/skin.php';
$skinobj = new Skin($skin->id);
$viewskin = $skinobj->get('viewskin');
$viewskin[$key] = 'Arial';
// the default font
$skinobj->set('viewskin', $viewskin);
$skinobj->commit();
}
}
}
}
// Also delete all the files in the appropriate folder and the folder itself...
$fontpath = get_config('dataroot') . 'skins/fonts/' . $fontname;
recurse_remove_dir($fontpath);
$SESSION->add_ok_msg(get_string('fontdeleted', 'skin'));
}
redirect('/admin/site/fonts.php');
}
示例2: xmldb_core_upgrade
//.........这里部分代码省略.........
}
if ($oldversion < 2014032400) {
$table = new XMLDBTable('group');
$field = new XMLDBField('sendnow');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
}
if ($oldversion < 2014032500) {
$table = new XMLDBTable('usr');
$field = new XMLDBField('probation');
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
}
if ($oldversion < 2014032600) {
set_config('watchlistnotification_delay', 20);
if (!table_exists(new XMLDBTable('watchlist_queue'))) {
$table = new XMLDBTable('watchlist_queue');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('usr', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('block', XMLDB_TYPE_INTEGER, 10, null, false);
$table->addFieldInfo('view', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('changed_on', XMLDB_TYPE_DATETIME, null, null, XMLDB_NOTNULL);
$table->addKeyInfo('viewfk', XMLDB_KEY_FOREIGN, array('view'), 'view', array('id'));
$table->addKeyInfo('blockfk', XMLDB_KEY_FOREIGN, array('block'), 'block_instance', array('id'));
$table->addKeyInfo('usrfk', XMLDB_KEY_FOREIGN, array('usr'), 'usr', array('id'));
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id'));
create_table($table);
}
// new event type: delete blockinstance
$e = new stdClass();
$e->name = 'deleteblockinstance';
ensure_record_exists('event_type', $e, $e);
// install the core event subscriptions
$subs = array(array('event' => 'blockinstancecommit', 'callfunction' => 'watchlist_record_changes'), array('event' => 'deleteblockinstance', 'callfunction' => 'watchlist_block_deleted'), array('event' => 'saveartefact', 'callfunction' => 'watchlist_record_changes'), array('event' => 'saveview', 'callfunction' => 'watchlist_record_changes'));
foreach ($subs as $sub) {
ensure_record_exists('event_subscription', (object) $sub, (object) $sub);
}
// install the cronjobs...
$cron = new stdClass();
$cron->callfunction = 'watchlist_process_notifications';
$cron->minute = '*';
$cron->hour = '*';
$cron->day = '*';
$cron->month = '*';
$cron->dayofweek = '*';
ensure_record_exists('cron', $cron, $cron);
}
if ($oldversion < 2014032700) {
// Remove bad data created by the upload user via csv where users in no institution
// have 'licensedefault' set causing an error
execute_sql("DELETE FROM {usr_account_preference} WHERE FIELD = 'licensedefault' AND usr IN (\n SELECT u.id FROM {usr} u\n LEFT JOIN {usr_institution} ui ON ui.usr = u.id\n WHERE ui.institution = 'mahara' OR ui.institution is null\n )");
}
if ($oldversion < 2014040300) {
// Figure out where the magicdb is, and stick with that.
require_once get_config('libroot') . 'file.php';
update_magicdb_path();
}
// Add id field and corresponding index to institution table.
if ($oldversion < 2014040400) {
$table = new XMLDBTable('institution');
// Add id field.
$field = new XMLDBField('id');
if (!field_exists($table, $field)) {
// Field.
$field->setAttributes(XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, null, null, 1, 'name');
add_field($table, $field);
示例3: remove_background
/**
* Given a background image to delete, remove it from skin and update the skin thumbs
*
* @param int $aid Artefact id of the background image to remove from skins
*/
public static function remove_background($aid)
{
$skinstoupdate = get_records_select_array('skin', 'bodybgimg = ? OR viewbgimg = ?', array($aid, $aid), 'id');
if (!empty($skinstoupdate) && is_array($skinstoupdate)) {
foreach ($skinstoupdate as $skin) {
$skin = new Skin($skin->id);
$viewskin = $skin->get('viewskin');
if (isset($viewskin['body_background_image']) && $viewskin['body_background_image'] == $aid) {
$viewskin['body_background_image'] = 0;
}
if (isset($viewskin['view_background_image']) && $viewskin['view_background_image'] == $aid) {
// TODO remove this
$viewskin['view_background_image'] = 0;
}
$skin->set('viewskin', $viewskin);
$skin->commit();
}
}
}