本文整理汇总了PHP中projects::getUserProjectRelation方法的典型用法代码示例。如果您正苦于以下问题:PHP projects::getUserProjectRelation方法的具体用法?PHP projects::getUserProjectRelation怎么用?PHP projects::getUserProjectRelation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects
的用法示例。
在下文中一共展示了projects::getUserProjectRelation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
//Only admins
if ($_SESSION['userdata']['role'] == 'admin') {
if (isset($_GET['id']) === true) {
$project = new projects();
$id = (int) $_GET['id'];
$row = $this->getUser($id);
$edit = false;
$infoKey = '';
//Build values array
$values = array('firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'user' => $row['username'], 'phone' => $row['phone'], 'status' => $row['status'], 'role' => $row['role'], 'hours' => $row['hours'], 'wage' => $row['wage'], 'clientId' => $row['clientId']);
if (isset($_POST['save'])) {
$values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'status' => $_POST['status'], 'role' => $_POST['role'], 'hours' => $_POST['hours'], 'wage' => $_POST['wage'], 'clientId' => $_POST['client']);
$changedEmail = 0;
if ($row['username'] != $values['user']) {
$changedEmail = 1;
}
if ($values['user'] !== '') {
$helper = new helper();
if ($helper->validateEmail($values['user']) === 1) {
if ($changedEmail == 1) {
if ($this->usernameExist($row['username'], $id) === false) {
$edit = true;
} else {
$tpl->setNotification('USERNAME_EXISTS', 'error');
}
} else {
$edit = true;
}
} else {
$tpl->setNotification('NO_VALID_EMAIL_' . $helper->validateEmail($values['user']), 'error');
}
} else {
$tpl->setNotification('NO_USERNAME', 'error');
}
}
//Was everything okay?
if ($edit !== false) {
$this->editUser($values, $id);
if (isset($_POST['projects'])) {
if ($_POST['projects'][0] !== '0') {
$project->editUserProjectRelations($id, $_POST['projects']);
} else {
$project->deleteAllProjectRelations($id);
}
}
$tpl->setNotification('EDIT_SUCCESS', 'success');
}
// Get relations to projects
$projects = $project->getUserProjectRelation($id);
$projectrelation = array();
foreach ($projects as $projectId) {
$projectrelation[] = $projectId['projectId'];
}
//Assign vars
$clients = new clients();
$tpl->assign('clients', $clients->getAll());
$tpl->assign('allProjects', $project->getAll());
$tpl->assign('values', $values);
$tpl->assign('relations', $projectrelation);
$tpl->assign('roles', $this->getRoles());
$tpl->assign('status', $this->status);
$tpl->display('users.editUser');
} else {
$tpl->display('general.error');
}
} else {
$tpl->display('general.error');
}
}