本文整理汇总了PHP中Groups::isOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::isOwner方法的具体用法?PHP Groups::isOwner怎么用?PHP Groups::isOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::isOwner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderProposal
function renderProposal($proposal, $target = 'none', $follow_action = 'show')
{
//A proposal consists of: fields = array('proposal_id', 'owner_id', 'org_id', 'inst_id',
//'supervisor_id', 'pid', 'solution_short', 'solution_long', 'state',);
$propid = $proposal->proposal_id;
$buttons = '';
if (Users::isStudent() && Groups::isOwner(_PROPOSAL_OBJ, $propid) && $proposal->state != 'published') {
$delete_action = "onclick='if(confirm(\"" . t('Are you sure you want to delete this proposal?') . "\")){ajaxCall(\"proposal\", \"delete\", " . "{type: \"proposal\", proposal_id: {$propid}, target: \"{$target}\"}, \"refreshTabs\", \"json\", " . "[\"proposal\", \"{$target}\", \"proposal\", \"\", \"{$follow_action}\"]);}'";
$edit_action = "onclick='ajaxCall(\"proposal\", \"edit\", {type: \"proposal\", proposal_id: {$propid}, target: " . "\"{$target}\", format:\"html\"}, \"formResult\", \"html\", [\"{$target}\", \"proposal\"]);'";
$buttons .= "<div class='totheright' id='proposal_buttons'><input type='button' value='" . t('edit') . "' {$edit_action}/>";
$buttons .= "<input type='button' value='" . t('delete') . "' {$delete_action}/></div>";
}
$content = "<div id='msg_{$target}'></div>\r\n\t{$buttons}" . "<h1>" . ($proposal->title ? $proposal->title : Proposal::getDefaultName('', $proposal)) . " (" . renderDefaultField('state', $proposal) . ")</h1>\r\n\r\n\t<div id='personalia'>\r\n\t<h3>Parties involved</h3>\r\n\t\t<ul>\r\n\t\t\t<li>" . t('Supervisor') . ": " . renderDefaultField('supervisor_name', $proposal, 'supervisor_user_name') . "</i>" . "<li>" . t('Mentor') . ": " . renderDefaultField('mentor_name', $proposal, 'mentor_user_name') . "</i>" . "<li>" . t('Student') . ": " . renderDefaultField('student_name', $proposal, 'name') . "</i>" . "<li>" . t('Institute') . ": " . renderDefaultField('i_name', $proposal) . "</i>" . "<li>" . t('Organisation') . ": " . renderDefaultField('o_name', $proposal) . "</i>" . "</ul>\r\n\t</div>" . "<div id='project'>\r\n\t\t" . t('Project') . ": " . $proposal->pr_title . "\r\n\t</div>" . "<div id='proposal_text'>\r\n\t\t<h3>" . t('Solution Summary') . "</h3>\r\n\t\t" . renderDefaultField('solution_short', $proposal) . "<br/>" . "<a href='javascript:void(0)' data='off' onclick='makeVisible(\"solution_{$propid}\");'>" . t('more') . "</a>" . "\r\n\t\t\t<div id='solution_{$propid}' class='invisible'>\r\n\t\t\t<h3>Solution</h3>\r\n\t\t\t" . renderDefaultField('solution_long', $proposal) . "\r\n\t\t\t</div>\r\n\t</div>";
module_load_include('inc', 'vals_soc', 'includes/ui/comments/threaded_comments');
$content .= initComments($propid, _PROPOSAL_OBJ);
return $content;
}
示例2: 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;
}
示例3: jsonBadResultJT
//Return error message
jsonBadResultJT($ex->getMessage());
}
break;
case 'accept_proposal_offer':
if (!Users::isStudent()) {
echo jsonBadResult(t('Only students can accept project offers'));
return;
}
$student = $GLOBALS['user']->uid;
if (Agreement::getInstance()->getSingleStudentsAgreement()) {
echo t('You have already accepted a project offer');
return;
}
if (isset($_POST['proposal_id']) && $_POST['proposal_id'] && isset($_POST['project_id']) && $_POST['project_id']) {
if (Groups::isOwner('proposal', $_POST['proposal_id'])) {
$proposal_id = $_POST['proposal_id'];
module_load_include('inc', 'vals_soc', 'includes/module/vals_soc.mail');
// get ALL my proposals
$all_my_proposals = Proposal::getInstance()->getProposalsBySearchCriteria($student, '', '', '', '', 0, 1000);
foreach ($all_my_proposals as $my_proposal) {
if ($my_proposal->proposal_id == $proposal_id) {
$project_id = $my_proposal->pid;
// next find all the other proposals for this project
$all_proposals_for_this_project = Proposal::getInstance()->getProposalsPerProject($project_id, '', true);
// TODO - may need to set details flag here
foreach ($all_proposals_for_this_project as $single_proposal_for_accepted_project) {
if ($single_proposal_for_accepted_project->proposal_id == $proposal_id) {
//email SUCCESSFUL (student, supervisor, mentor) that this project has now been accepted by this student
notify_all_of_project_offer_acceptance($single_proposal_for_accepted_project, $proposal_id, true);
$props = array();