本文整理汇总了PHP中Groups::isAssociate方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::isAssociate方法的具体用法?PHP Groups::isAssociate怎么用?PHP Groups::isAssociate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::isAssociate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderProject
function renderProject($project = '', $target = '', $inline = FALSE, $all_can_edit = _VALS_SOC_MENTOR_ACCESS_ALL)
{
if (!$project) {
return t('I cannot show this project. It seems empty.');
}
if (is_object($project)) {
$project = objectToArray($project);
} else {
//It is NOT an object, so: array
}
$key_name = Groups::keyField(_PROJECT_OBJ);
$id = $project[$key_name];
$type = _PROJECT_OBJ;
$role = getRole();
$content = "<div class=\"totheright\">";
if (_STUDENT_TYPE == getRole()) {
$content .= "<br/><br/><input type='button' onclick=\"getProposalFormForProject(" . $project['pid'] . ")\" value='.t( 'Submit proposal for this project').'/>";
}
$is_inproject_organisation = Groups::isAssociate(_PROJECT_OBJ, $id);
//If not inline and either owner or mentor and mentors allowed to edit...
if (!$inline && ($all_can_edit && $is_inproject_organisation || Groups::isOwner(_PROJECT_OBJ, $id))) {
$delete_action = "onclick='if(confirm(\"" . t('Are you sure you want to delete this project?') . "\")){ajaxCall(\"project\", \"delete\", {type: \"{$type}\", id: {$id}, target: \"{$target}\"}, \"refreshTabs\", \"json\", [\"{$type}\", \"{$target}\", \"project\"]);}'";
$edit_action = "onclick='ajaxCall(\"project\", \"edit\", {type: \"{$type}\", id: {$id}, target: \"{$target}\"}, \"formResult\", \"html\", [\"{$target}\", \"project\"]);'";
$content .= "<input type='button' value='" . t('edit') . "' {$edit_action}/>";
$content .= "<input type='button' value='" . t('delete') . "' {$delete_action}/>";
}
$content .= "</div>";
$content .= "<h2>" . $project['title'] . "</h2>";
if ($is_inproject_organisation) {
$content .= "<h3>Statistics</h3>";
$content .= "<p>Number of student views: " . $project['views'] . "<BR>" . "Number of times marked by a student: " . $project['likes'] . "</p>";
}
$content .= '<p>' . $project['description'] . '</p>';
if ($project['url']) {
$content .= '<p>' . tt('More information can be found at %1$s', "<a href='{$project['url']}'> {$project['url']}</a>") . '</p>';
}
if (!$inline) {
if (getRole() != _ANONYMOUS_TYPE) {
module_load_include('inc', 'vals_soc', 'includes/ui/comments/threaded_comments');
$content .= initComments($id, _PROJECT_OBJ);
}
}
return $content;
}
示例2: array
$prev_nr = $current > 0 ? $current - 1 : FALSE;
$prev_pid = $prev_nr !== FALSE ? $_SESSION['lists']['projects']['list'][$prev_nr]->pid : FALSE;
$project['nav'] = array('next_pid' => $next_pid, 'next_nr' => $next_nr, 'prev_pid' => $prev_pid, 'prev_nr' => $prev_nr);
break;
}
$current++;
}
}
}
//It might be that the project is in draft and is not returned by the browse and so it is not
//present in the session lists
if (!$project) {
$project = Project::getProjectById($project_id, false, PDO::FETCH_ASSOC, true);
}
$my_id = Users::getMyId();
if ($project['state'] == 'draft' && !($project['mentor_id'] == $my_id || $project['owner_id'] == $my_id || Users::isAdmin() || Groups::isAssociate(_PROJECT_OBJ, $project_id))) {
jsonBadResult(t('You cannot view this proposal. It is in draft state.'));
return;
}
if (Users::isSuperVisor()) {
$project['rate'] = Project::getRating($project_id, $my_id);
} else {
$project['rate'] = -2;
if (Users::isStudent()) {
$table = tableName('student_favourite');
$favourite = db_select($table)->fields($table)->condition('pid', $project_id)->condition('uid', $my_id)->execute()->rowCount();
$project['favourite'] = $favourite != 0;
//Count the views of the students
$result = db_update(tableName('project'))->condition('pid', $project_id)->fields(array('views' => $project['views'] + 1))->execute();
}
}