本文整理汇总了PHP中ArtefactType::update_locked方法的典型用法代码示例。如果您正苦于以下问题:PHP ArtefactType::update_locked方法的具体用法?PHP ArtefactType::update_locked怎么用?PHP ArtefactType::update_locked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArtefactType
的用法示例。
在下文中一共展示了ArtefactType::update_locked方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitview_submit
function submitview_submit(Pieform $form, $values)
{
global $SESSION, $USER, $viewid, $groupid, $group;
db_begin();
update_record('view', array('submittedgroup' => $groupid, 'submittedtime' => db_format_timestamp(time())), array('id' => $viewid));
$roles = get_column('grouptype_roles', 'role', 'grouptype', $group->grouptype, 'see_submitted_views', 1);
foreach ($roles as $role) {
$accessrecord = (object) array('view' => $viewid, 'group' => $groupid, 'role' => $role, 'visible' => 0, 'allowcomments' => 1, 'approvecomments' => 0);
ensure_record_exists('view_access', $accessrecord, $accessrecord);
}
ArtefactType::update_locked($USER->get('id'));
activity_occurred('groupmessage', array('subject' => get_string('viewsubmitted', 'view'), 'message' => get_string('viewsubmitted', 'view'), 'submittedview' => $viewid, 'viewowner' => $USER->get('id'), 'group' => $groupid, 'roles' => $roles, 'strings' => (object) array('urltext' => (object) array('key' => 'view'))));
db_commit();
$SESSION->add_ok_msg(get_string('viewsubmitted', 'view'));
redirect('/' . returnto());
}
示例2: xmldb_core_upgrade
//.........这里部分代码省略.........
$license->displayname = get_string('licensedisplaynamebyncsa', 'install');
$license->shortname = get_string('licenseshortnamebyncsa', 'install');
$license->icon = 'license:by-nc-sa.png';
$version30 = 'http://creativecommons.org/licenses/by-nc-sa/3.0/';
if (!record_exists('artefact_license', 'name', $license->name) && record_exists('artefact_license', 'name', $version30)) {
insert_record('artefact_license', $license);
}
$license = new stdClass();
$license->name = 'http://creativecommons.org/licenses/by-nc/4.0/';
$license->displayname = get_string('licensedisplaynamebync', 'install');
$license->shortname = get_string('licenseshortnamebync', 'install');
$license->icon = 'license:by-nc.png';
$version30 = 'http://creativecommons.org/licenses/by-nc/3.0/';
if (!record_exists('artefact_license', 'name', $license->name) && record_exists('artefact_license', 'name', $version30)) {
insert_record('artefact_license', $license);
}
$license = new stdClass();
$license->name = 'http://creativecommons.org/licenses/by-nc-nd/4.0/';
$license->displayname = get_string('licensedisplaynamebyncnd', 'install');
$license->shortname = get_string('licenseshortnamebyncnd', 'install');
$license->icon = 'license:by-nc-nd.png';
$version30 = 'http://creativecommons.org/licenses/by-nc-nd/3.0/';
if (!record_exists('artefact_license', 'name', $license->name) && record_exists('artefact_license', 'name', $version30)) {
insert_record('artefact_license', $license);
}
}
if ($oldversion < 2014022400) {
// Make sure artefacts are properly locked for submitted views.
// Can be a problem for older sites
$submitted = get_records_sql_array("SELECT v.owner FROM {view_artefact} va\n LEFT JOIN {view} v on v.id = va.view\n LEFT JOIN {artefact} a on a.id = va.artefact\n WHERE (v.submittedgroup IS NOT NULL OR v.submittedhost IS NOT NULL)", array());
if ($submitted) {
require_once get_config('docroot') . 'artefact/lib.php';
foreach ($submitted as $record) {
ArtefactType::update_locked($record->owner);
}
}
}
if ($oldversion < 2014022600) {
$table = new XMLDBTable('host');
$field = new XMLDBField('portno');
drop_field($table, $field);
}
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'));
示例3: _db_submit
/**
* Lower-level function to handle all the DB changes that should occur when you submit a view or views
*
* @param array $viewids The views to submit. (Normally one view by itself, or all the views in a Collection)
* @param object $submittedgroupobj An object holding information about the group submitting to. Should contain id and roles array
* @param string $submittedhost Alternately, the name of the remote host the group is being submitted to (for MNet submission)
* @param int $owner The ID of the owner of the view. Used mostly for verification purposes.
*/
public static function _db_submit($viewids, $submittedgroupobj = null, $submittedhost = null, $owner = null)
{
global $USER;
require_once get_config('docroot') . 'artefact/lib.php';
$group = $submittedgroupobj;
// Gotta provide some viewids and/or a remote username
if (empty($viewids) || empty($group->id) && empty($submittedhost)) {
return;
}
$idstr = join(',', array_map('intval', $viewids));
$userid = $owner == null ? $USER->get('id') : $owner;
$sql = 'UPDATE {view} SET submittedtime = current_timestamp, submittedstatus = ' . self::SUBMITTED;
$params = array();
if ($group) {
$groupid = (int) $group->id;
$sql .= ', submittedgroup = ? ';
$params[] = $groupid;
} else {
$sql .= ', submittedhost = ? ';
$params[] = $submittedhost;
}
$sql .= " WHERE id IN ({$idstr}) AND owner = ?";
$params[] = $userid;
db_begin();
execute_sql($sql, $params);
if ($group) {
foreach ($group->roles as $role) {
foreach ($viewids as $viewid) {
$accessrecord = (object) array('view' => $viewid, 'group' => $groupid, 'role' => $role, 'visible' => 0, 'allowcomments' => 1, 'approvecomments' => 0, 'ctime' => db_format_timestamp(time()));
ensure_record_exists('view_access', $accessrecord, $accessrecord);
}
}
}
ArtefactType::update_locked($userid);
db_commit();
}
示例4: submit_view_for_assessment
function submit_view_for_assessment($username, $viewid)
{
global $REMOTEWWWROOT;
list($user, $authinstance) = find_remote_user($username, $REMOTEWWWROOT);
if (!$user) {
return false;
}
$viewid = (int) $viewid;
if (!$viewid) {
return false;
}
require_once 'view.php';
$view = new View($viewid);
$view->set('submittedhost', $authinstance->config['wwwroot']);
$view->set('submittedtime', db_format_timestamp(time()));
// Create secret key
$access = View::new_token($view->get('id'), false);
$data = array('id' => $view->get('id'), 'title' => $view->get('title'), 'description' => $view->get('description'), 'fullurl' => get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') . '&mt=' . $access->token, 'url' => '/view/view.php?id=' . $view->get('id') . '&mt=' . $access->token, 'accesskey' => $access->token);
foreach (plugins_installed('artefact') as $plugin) {
safe_require('artefact', $plugin->name);
$classname = generate_class_name('artefact', $plugin->name);
if (is_callable($classname . '::view_submit_external_data')) {
$data[$plugin->name] = call_static_method($classname, 'view_submit_external_data', $view->get('id'));
}
}
$view->commit();
// Lock view contents
require_once get_config('docroot') . 'artefact/lib.php';
ArtefactType::update_locked($user->get('id'));
return $data;
}
示例5: release
public function release($releaseuser = null)
{
require_once get_config('docroot') . 'artefact/lib.php';
$submitinfo = $this->submitted_to();
if (is_null($submitinfo)) {
throw new ParameterException("View with id " . $this->get('id') . " has not been submitted");
}
$releaseuser = optional_userobj($releaseuser);
db_begin();
if ($submitinfo['type'] == 'group') {
$group = $this->get('submittedgroup');
$this->set('submittedgroup', null);
if ($group) {
// Remove hidden tutor view access records
delete_records('view_access', 'view', $this->id, 'group', $group, 'visible', 0);
}
} else {
if ($submitinfo['type'] == 'host') {
$this->set('submittedhost', null);
}
}
$this->set('submittedtime', null);
$this->commit();
ArtefactType::update_locked($this->owner);
db_commit();
$ownerlang = get_user_language($this->get('owner'));
$url = get_config('wwwroot') . 'view/view.php?id=' . $this->get('id');
require_once 'activity.php';
activity_occurred('maharamessage', array('users' => array($this->get('owner')), 'subject' => get_string_from_language($ownerlang, 'viewreleasedsubject', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'message' => get_string_from_language($ownerlang, 'viewreleasedmessage', 'group', $this->get('title'), $submitinfo['name'], display_name($releaseuser, $this->get_owner_object())), 'url' => $url, 'urltext' => $this->get('title')));
}