本文整理汇总了PHP中UserList::update方法的典型用法代码示例。如果您正苦于以下问题:PHP UserList::update方法的具体用法?PHP UserList::update怎么用?PHP UserList::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddList
function AddList()
{
global $user;
$return = array();
if ($user) {
require_once ROOT_DIR . '/sys/LocalEnrichment/UserList.php';
$title = isset($_REQUEST['title']) ? urldecode($_REQUEST['title']) : '';
if (strlen(trim($title)) == 0) {
$return['result'] = "false";
$return['message'] = "You must provide a title for the list";
} else {
$list = new UserList();
$list->title = $title;
$list->user_id = $user->id;
//Check to see if there is already a list with this id
$existingList = false;
if ($list->find(true)) {
$existingList = true;
}
$list->description = urldecode($_REQUEST['desc']);
$list->public = $_REQUEST['public'];
if ($existingList) {
$list->update();
} else {
$list->insert();
}
if (isset($_REQUEST['recordId'])) {
$recordToAdd = urldecode($_REQUEST['recordId']);
require_once ROOT_DIR . '/sys/LocalEnrichment/UserListEntry.php';
//Check to see if the user has already added the title to the list.
$userListEntry = new UserListEntry();
$userListEntry->listId = $list->id;
$userListEntry->groupedWorkPermanentId = $recordToAdd;
if (!$userListEntry->find(true)) {
$userListEntry->dateAdded = time();
$userListEntry->insert();
}
}
$return['result'] = 'true';
$return['newId'] = $list->id;
if ($existingList) {
$return['message'] = "Updated list {$title} successfully";
} else {
$return['message'] = "Created list {$title} successfully";
}
}
} else {
$return['result'] = "false";
$return['message'] = "You must be logged in to create a list";
}
return $return;
}