本文整理汇总了PHP中DAO_Worker::update方法的典型用法代码示例。如果您正苦于以下问题:PHP DAO_Worker::update方法的具体用法?PHP DAO_Worker::update怎么用?PHP DAO_Worker::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAO_Worker
的用法示例。
在下文中一共展示了DAO_Worker::update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveWorkerPeekAction
function saveWorkerPeekAction()
{
$translate = DevblocksPlatform::getTranslationService();
$active_worker = FegApplication::getActiveWorker();
if (!$active_worker || !$active_worker->is_superuser) {
return;
}
@($id = DevblocksPlatform::importGPC($_POST['id'], 'integer'));
@($view_id = DevblocksPlatform::importGPC($_POST['view_id'], 'string'));
@($first_name = DevblocksPlatform::importGPC($_POST['first_name'], 'string'));
@($last_name = DevblocksPlatform::importGPC($_POST['last_name'], 'string'));
@($title = DevblocksPlatform::importGPC($_POST['title'], 'string'));
@($email = DevblocksPlatform::importGPC($_POST['email'], 'string'));
@($password = DevblocksPlatform::importGPC($_POST['password'], 'string'));
@($is_superuser = DevblocksPlatform::importGPC($_POST['is_superuser'], 'integer', 0));
@($disabled = DevblocksPlatform::importGPC($_POST['is_disabled'], 'integer', 0));
// @$group_ids = DevblocksPlatform::importGPC($_POST['group_ids'],'array');
// @$group_roles = DevblocksPlatform::importGPC($_POST['group_roles'],'array');
@($delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
// [TODO] The superuser set bit here needs to be protected by ACL
if (empty($first_name)) {
$first_name = "Anonymous";
}
if (!empty($id) && !empty($delete)) {
// Can't delete or disable self
if ($active_worker->id != $id) {
DAO_Worker::delete($id);
}
} else {
if (empty($id) && null == DAO_Worker::getWhere(sprintf("%s=%s", DAO_Worker::EMAIL, Feg_ORMHelper::qstr($email)))) {
$workers = DAO_Worker::getAll();
$license = FegLicense::getInstance();
if (!empty($license) && !empty($license['serial']) || count($workers) < 3) {
// Creating new worker. If password is empty, email it to them
if (empty($password)) {
$settings = DevblocksPlatform::getPluginSettingsService();
$replyFrom = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM);
$replyPersonal = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_PERSONAL, '');
$url = DevblocksPlatform::getUrlService();
$password = FegApplication::generatePassword(8);
}
$fields = array(DAO_Worker::EMAIL => $email, DAO_Worker::PASS => $password);
$id = DAO_Worker::create($fields);
}
}
// end create worker
// Update
$fields = array(DAO_Worker::FIRST_NAME => $first_name, DAO_Worker::LAST_NAME => $last_name, DAO_Worker::TITLE => $title, DAO_Worker::EMAIL => $email, DAO_Worker::IS_SUPERUSER => $is_superuser, DAO_Worker::IS_DISABLED => $disabled);
// if we're resetting the password
if (!empty($password)) {
$fields[DAO_Worker::PASS] = md5($password);
}
// Update worker
DAO_Worker::update($id, $fields);
// Custom field saves
@($field_ids = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
DAO_CustomFieldValue::handleFormPost(FegCustomFieldSource_Worker::ID, $id, $field_ids);
}
if (!empty($view_id)) {
$view = Feg_AbstractViewLoader::getView($view_id);
$view->render();
}
}
示例2: saveWorkerPeekAction
function saveWorkerPeekAction()
{
$translate = DevblocksPlatform::getTranslationService();
$active_worker = PortSensorApplication::getActiveWorker();
if (!$active_worker || !$active_worker->is_superuser) {
return;
}
@($id = DevblocksPlatform::importGPC($_POST['id'], 'integer'));
@($view_id = DevblocksPlatform::importGPC($_POST['view_id'], 'string'));
@($first_name = DevblocksPlatform::importGPC($_POST['first_name'], 'string'));
@($last_name = DevblocksPlatform::importGPC($_POST['last_name'], 'string'));
@($title = DevblocksPlatform::importGPC($_POST['title'], 'string'));
@($email = DevblocksPlatform::importGPC($_POST['email'], 'string'));
@($password = DevblocksPlatform::importGPC($_POST['password'], 'string'));
@($is_superuser = DevblocksPlatform::importGPC($_POST['is_superuser'], 'integer', 0));
@($disabled = DevblocksPlatform::importGPC($_POST['is_disabled'], 'integer', 0));
// @$group_ids = DevblocksPlatform::importGPC($_POST['group_ids'],'array');
// @$group_roles = DevblocksPlatform::importGPC($_POST['group_roles'],'array');
@($delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
// [TODO] The superuser set bit here needs to be protected by ACL
if (empty($first_name)) {
$first_name = "Anonymous";
}
if (!empty($id) && !empty($delete)) {
// Can't delete or disable self
if ($active_worker->id != $id) {
DAO_Worker::delete($id);
}
} else {
if (empty($id) && null == DAO_Worker::getWhere(sprintf("%s=%s", DAO_Worker::EMAIL, Ps_ORMHelper::qstr($email)))) {
$workers = DAO_Worker::getAll();
$license = PortSensorLicense::getInstance();
if (!empty($license) && !empty($license['serial']) || count($workers) < 3) {
// Creating new worker. If password is empty, email it to them
if (empty($password)) {
$settings = DevblocksPlatform::getPluginSettingsService();
$replyFrom = $settings->get('portsensor.core', PortSensorSettings::DEFAULT_REPLY_FROM);
$replyPersonal = $settings->get('portsensor.core', PortSensorSettings::DEFAULT_REPLY_PERSONAL, '');
$url = DevblocksPlatform::getUrlService();
$password = PortSensorApplication::generatePassword(8);
// try {
// $mail_service = DevblocksPlatform::getMailService();
// $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults());
// $mail = $mail_service->createMessage();
//
// $mail->setTo(array($email => $first_name . ' ' . $last_name));
// $mail->setFrom(array($replyFrom => $replyPersonal));
// $mail->setSubject('Your new helpdesk login information!');
// $mail->generateId();
//
// $headers = $mail->getHeaders();
//
// $headers->addTextHeader('X-Mailer','Cerberus Helpdesk (Build '.APP_BUILD.')');
//
// $body = sprintf("Your new helpdesk login information is below:\r\n".
// "\r\n".
// "URL: %s\r\n".
// "Login: %s\r\n".
// "Password: %s\r\n".
// "\r\n".
// "You should change your password from Preferences after logging in for the first time.\r\n".
// "\r\n",
// $url->write('',true),
// $email,
// $password
// );
//
// $mail->setBody($body);
//
// if(!$mailer->send($mail)) {
// throw new Exception('Password notification email failed to send.');
// }
// } catch (Exception $e) {
// // [TODO] need to report to the admin when the password email doesn't send. The try->catch
// // will keep it from killing php, but the password will be empty and the user will never get an email.
// }
}
$fields = array(DAO_Worker::EMAIL => $email, DAO_Worker::PASS => $password);
$id = DAO_Worker::create($fields);
}
}
// end create worker
// Update
$fields = array(DAO_Worker::FIRST_NAME => $first_name, DAO_Worker::LAST_NAME => $last_name, DAO_Worker::TITLE => $title, DAO_Worker::EMAIL => $email, DAO_Worker::IS_SUPERUSER => $is_superuser, DAO_Worker::IS_DISABLED => $disabled);
// if we're resetting the password
if (!empty($password)) {
$fields[DAO_Worker::PASS] = md5($password);
}
// Update worker
DAO_Worker::update($id, $fields);
// Update group memberships
// if(is_array($group_ids) && is_array($group_roles))
// foreach($group_ids as $idx => $group_id) {
// if(empty($group_roles[$idx])) {
// DAO_Group::unsetTeamMember($group_id, $id);
// } else {
// DAO_Group::setTeamMember($group_id, $id, (2==$group_roles[$idx]));
// }
// }
// Add the worker e-mail to the addresses table
//.........这里部分代码省略.........
示例3: doRecoverStep3Action
function doRecoverStep3Action()
{
@($password = DevblocksPlatform::importGPC($_REQUEST['password'], 'string'));
$email = $_SESSION[self::KEY_FORGOT_EMAIL];
$sentcode = $_SESSION[self::KEY_FORGOT_SENTCODE];
$code = $_SESSION[self::KEY_FORGOT_CODE];
$worker = null;
$results = DAO_Worker::getWhere(sprintf("%s = %s", DAO_Worker::EMAIL, Um_ORMHelper::qstr($email)));
if (!empty($results)) {
$worker = array_shift($results);
}
if (empty($email) || empty($code) || empty($worker)) {
return;
}
if (0 == strcmp($sentcode, $code)) {
// passed
DAO_Worker::update($worker->id, array(DAO_Worker::PASS => md5($password)));
unset($_SESSION[self::KEY_FORGOT_EMAIL]);
unset($_SESSION[self::KEY_FORGOT_CODE]);
unset($_SESSION[self::KEY_FORGOT_SENTCODE]);
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login')));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
}
}
示例4: logActivity
/**
* Store the workers last activity (provided by the page extension).
*
* @param integer $worker_id
* @param Model_Activity $activity
*/
static function logActivity($worker_id, Model_Activity $activity)
{
DAO_Worker::update($worker_id, array(DAO_Worker::LAST_ACTIVITY_DATE => time(), DAO_Worker::LAST_ACTIVITY => serialize($activity)), false);
}
示例5: doBulkUpdate
function doBulkUpdate($filter, $do, $ids = array())
{
@set_time_limit(600);
// [TODO] Temp!
$change_fields = array();
$custom_fields = array();
if (empty($do)) {
return;
}
if (is_array($do)) {
foreach ($do as $k => $v) {
switch ($k) {
case 'is_disabled':
$change_fields[DAO_Worker::IS_DISABLED] = intval($v);
break;
default:
// Custom fields
if (substr($k, 0, 3) == "cf_") {
$custom_fields[substr($k, 3)] = $v;
}
break;
}
}
}
$pg = 0;
if (empty($ids)) {
do {
list($objects, $null) = DAO_Worker::search(array(), $this->params, 100, $pg++, SearchFields_Worker::ID, true, false);
$ids = array_merge($ids, array_keys($objects));
} while (!empty($objects));
}
$batch_total = count($ids);
for ($x = 0; $x <= $batch_total; $x += 100) {
$batch_ids = array_slice($ids, $x, 100);
DAO_Worker::update($batch_ids, $change_fields);
// Custom Fields
self::_doBulkSetCustomFields(FegCustomFieldSource_Worker::ID, $custom_fields, $batch_ids);
unset($batch_ids);
}
unset($ids);
}
示例6: saveTabGeneralAction
function saveTabGeneralAction()
{
@($timezone = DevblocksPlatform::importGPC($_REQUEST['timezone'], 'string'));
@($lang_code = DevblocksPlatform::importGPC($_REQUEST['lang_code'], 'string', 'en_US'));
$worker = PortSensorApplication::getActiveWorker();
$translate = DevblocksPlatform::getTranslationService();
$tpl = DevblocksPlatform::getTemplateService();
// Time
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
DAO_WorkerPref::set($worker->id, 'timezone', $timezone);
// Language
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
DAO_WorkerPref::set($worker->id, 'locale', $lang_code);
@($new_password = DevblocksPlatform::importGPC($_REQUEST['change_pass'], 'string'));
@($verify_password = DevblocksPlatform::importGPC($_REQUEST['change_pass_verify'], 'string'));
//[mdf] if nonempty passwords match, update worker's password
if ($new_password != "" && $new_password === $verify_password) {
$session = DevblocksPlatform::getSessionService();
$fields = array(DAO_Worker::PASS => md5($new_password));
DAO_Worker::update($worker->id, $fields);
}
@($assist_mode = DevblocksPlatform::importGPC($_REQUEST['assist_mode'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'assist_mode', $assist_mode);
@($keyboard_shortcuts = DevblocksPlatform::importGPC($_REQUEST['keyboard_shortcuts'], 'integer', 0));
DAO_WorkerPref::set($worker->id, 'keyboard_shortcuts', $keyboard_shortcuts);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('preferences')));
}