本文整理匯總了PHP中Gdn_Model::Get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_Model::Get方法的具體用法?PHP Gdn_Model::Get怎麽用?PHP Gdn_Model::Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gdn_Model
的用法示例。
在下文中一共展示了Gdn_Model::Get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Get
/**
* Default Gdn_Model::Get() behavior.
*
* Prior to 2.0.18 it incorrectly behaved like GetID.
* This method can be deleted entirely once it's been deprecated long enough.
*
* @since 2.0.0
* @return object DataSet
*/
public function Get($OrderFields = '', $OrderDirection = 'asc', $Limit = FALSE, $Offset = FALSE)
{
if (is_numeric($OrderFields)) {
// They're using the old version that was a misnamed GetID()
Deprecated('UserModel->Get()', 'UserModel->GetID()');
$Result = $this->GetID($OrderFields);
} else {
$Result = parent::Get($OrderFields, $OrderDirection, $Limit, $Offset);
}
return $Result;
}
示例2: Edit
public function Edit($UserID)
{
$this->Permission('Garden.Users.Edit');
$this->AddJsFile('user.js');
$this->AddSideMenu('garden/user');
$RoleModel = new Gdn_Model('Role');
$this->RoleData = $RoleModel->Get();
$UserModel = new Gdn_UserModel();
$this->User = $UserModel->Get($UserID);
// Set the model on the form.
$this->Form->SetModel($UserModel);
// Make sure the form knows which item we are editing.
$this->Form->AddHidden('UserID', $UserID);
if (!$this->Form->AuthenticatedPostBack()) {
$this->Form->SetData($this->User);
$this->UserRoleData = $UserModel->GetRoles($UserID);
} else {
// If a new password was specified, add it to the form's collection
$ResetPassword = $this->Form->GetValue('ResetPassword', FALSE);
$NewPassword = $this->Form->GetValue('NewPassword', '');
if ($ResetPassword !== FALSE) {
$this->Form->SetFormValue('Password', $NewPassword);
}
if ($this->Form->Save(array('SaveRoles' => TRUE)) !== FALSE) {
if ($this->Form->GetValue('Password', '') != '') {
$UserModel->SendPasswordEmail($UserID, $NewPassword);
}
$this->StatusMessage = T('Your changes have been saved successfully.');
}
$this->UserRoleData = $this->Form->GetFormValue('RoleID');
}
$this->Render();
}
示例3: Edit
public function Edit($UserID) {
$this->Permission('Garden.Users.Edit');
$this->AddJsFile('user.js');
$this->Title(T('Edit User'));
$this->AddSideMenu('dashboard/user');
$this->CanEditUsername = TRUE;
$this->CanEditUsername = $this->CanEditUsername & Gdn::Config("Garden.Profile.EditUsernames");
$this->CanEditUsername = $this->CanEditUsername | Gdn::Session()->CheckPermission('Garden.Users.Edit');
$RoleModel = new Gdn_Model('Role');
$this->RoleData = $RoleModel->Get();
$UserModel = new UserModel();
$this->User = $UserModel->Get($UserID);
// Set the model on the form.
$this->Form->SetModel($UserModel);
// Make sure the form knows which item we are editing.
$this->Form->AddHidden('UserID', $UserID);
if (!$this->Form->AuthenticatedPostBack()) {
$this->Form->SetData($this->User);
$this->UserRoleData = $UserModel->GetRoles($UserID);
} else {
if (!$this->CanEditUsername)
$this->Form->SetFormValue("Name", $this->User->Name);
// If a new password was specified, add it to the form's collection
$ResetPassword = $this->Form->GetValue('ResetPassword', FALSE);
$NewPassword = $this->Form->GetValue('NewPassword', '');
if ($ResetPassword !== FALSE)
$this->Form->SetFormValue('Password', $NewPassword);
if ($this->Form->Save(array('SaveRoles' => TRUE)) !== FALSE) {
if ($this->Form->GetValue('Password', '') != '')
$UserModel->SendPasswordEmail($UserID, $NewPassword);
$this->InformMessage(T('Your changes have been saved.'));
}
$this->UserRoleData = $this->Form->GetFormValue('RoleID');
}
$this->Render();
}