当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractEntity::keyField方法代码示例

本文整理汇总了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'
开发者ID:edwinraycom,项目名称:vals-soc,代码行数:31,代码来源:proposal_actions.php

示例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++;
            }
        }
    }
}
开发者ID:edwinraycom,项目名称:vals-soc,代码行数:64,代码来源:projects.php


注:本文中的AbstractEntity::keyField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。