本文整理汇总了PHP中AbstractEntity::keyField方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractEntity::keyField方法的具体用法?PHP AbstractEntity::keyField怎么用?PHP AbstractEntity::keyField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractEntity
的用法示例。
在下文中一共展示了AbstractEntity::keyField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$container = $is_modal ? 'admin_container' : 'our_content';
$before = 'toc';
$args = array('id' => $proposal_id, 'before' => $before, 'target' => $container, 'replace_target' => true);
$proposal_nr = Proposal::getInstance()->getProposalById($proposal_id);
if (!$proposal_nr) {
jsonBadResult(t('This proposal was already deleted!'), $args);
return;
}
$title = altPropertyValue($proposal_nr, 'title');
$state = altPropertyValue($proposal_nr, 'state');
if (!Groups::isOwner(_PROPOSAL_OBJ, $proposal_id)) {
jsonBadResult(t('You can only delete your own proposals!'), $args);
} elseif ($state == 'published') {
jsonBadResult(t('We could not remove your proposal: It has already been published.'), $args);
} else {
$num_deleted = db_delete(tableName(_PROPOSAL_OBJ))->condition(AbstractEntity::keyField(_PROPOSAL_OBJ), $proposal_id)->execute();
if ($num_deleted) {
// junk the proposal comments too
ThreadedComments::getInstance()->removethreadsForEntity($proposal_id, _PROPOSAL_OBJ);
$args['before'] = '';
jsonGoodResult(TRUE, tt('You have removed the proposal %1$s', $title), $args);
} else {
jsonBadResult(t('We could not remove your proposal'), $args);
}
}
} else {
jsonBadResult(t('No proposal identifier submitted!'), $args);
}
break;
case 'save_public':
// no break so that the request filters down to 'save'
示例2: showProjectPage
function showProjectPage($show_last = FALSE, $owner_only = false)
{
global $base_url;
//TODO check for the role of current user
$role = getRole();
if (!Users::isMentor()) {
//true for both mentors and organisation admins. Also, they will see their own stuff only
echo t('You are not allowed to see the projects in this view.');
return;
}
//Get my groups
$my_organisations = Groups::getGroups(_ORGANISATION_GROUP);
if (!$my_organisations->rowCount()) {
//There are no organisations yet for this user
if ($role == _ORGADMIN_TYPE) {
echo t('You have no organisation yet.') . '<br/>';
echo "<a href='" . _WEB_URL . "/dashboard/organisation/administer'>" . t('Please go to the organisation register page') . "</a>";
} else {
echo t('You are not connected to any organisation yet.') . '<br/>';
echo "<a href='" . _WEB_URL . "/user/" . Users::getMyId() . "/edit'>" . t('Please edit your account to connect') . "</a>";
}
} else {
$show_all = !(bool) $owner_only;
$owner_id = $GLOBALS['user']->uid;
$orgs = array();
$orgids = array();
foreach ($my_organisations as $org) {
$orgs[] = $org;
$orgids[] = $org->org_id;
}
$projects = Project::getProjectsByUser($owner_id, $orgids, $show_all);
//$my_organisations->fetchCol());
if (!$projects) {
echo $owner_only ? t('You have no project yet registered') : t('There are no projects yet registered.');
echo $owner_only ? "<BR>" . '<a href="' . $base_url . '/dashboard/projects/administer" ' . 'title="Manage all my organisation\'s projects">Manage all my organisation\'s projects</a>' : '';
echo '<h2>' . t('Add a project') . '</h2>';
$tab_prefix = 'project_page-';
$target = "{$tab_prefix}1";
$form = drupal_get_form("vals_soc_project_form", '', 'project_page-1');
$form['submit'] = ajax_pre_render_element($form['submit']);
$add_tab = renderForm($form, $target, true);
$data = array();
$data[] = array(1, 'Add', 'add', _PROJECT_OBJ, '0', "target=admin_container", true, 'adding from the right');
echo renderTabs(1, null, 'project_page-', _PROJECT_OBJ, $data, null, TRUE, $add_tab, 1, _PROJECT_OBJ);
?>
<script type="text/javascript">
transform_into_rte();
activatetabs('tab_', ['project_page-1']);
</script><?php
} else {
echo "<a href='" . _WEB_URL . "/dashboard/projects/administer'>" . t('Show all') . "</a>";
echo " | ";
echo "<a href='" . _WEB_URL . "/dashboard/projects/administer/mine'>" . t('Show only mine') . "</a>";
$org = 1;
$show_org_title = $my_organisations->rowCount() > 1;
$org_key = AbstractEntity::keyField(_ORGANISATION_GROUP);
foreach ($orgs as $organisation) {
$projects = Project::getProjectsByUser($owner_id, array($organisation->{$org_key}), $show_all);
showOrganisationProjects($org, $projects, $organisation, $show_org_title, $show_last, TRUE, $owner_only);
$org++;
}
}
}
}