Exemplo n.º 1
0
function showError($msg = '')
{
    $msg .= showDrupalMessages('error');
    if ($msg) {
        echo errorDiv($msg);
    }
}
Exemplo n.º 2
0
     //Return result to jTable
     $recs = Project::getInstance()->getProjectsAndProposalCountByCriteria($organisation, $owner_id, $_GET["jtSorting"], $_GET["jtStartIndex"], $_GET["jtPageSize"]);
     $cnt = Project::getInstance()->getProjectsAndProposalCountByCriteriaRowCount($organisation, $owner_id);
     jsonGoodResultJT($recs, $cnt);
     break;
 case 'list':
     try {
         $target = getRequestVar('target', null);
         $inline = getRequestVar('inline', false);
         $org_id = getRequestVar('org', null);
         $mine = getRequestVar('mine', false);
         $organisations = $org_id ? array($org_id) : null;
         echo renderProjects($organisations, '', $target, $inline, true, $mine);
     } catch (Exception $ex) {
         //Return error message
         errorDiv($ex->getMessage());
     }
     break;
 case 'project_detail':
     $project_id = getRequestVar('project_id', null);
     $project = null;
     if ($project_id) {
         try {
             if (isset($_SESSION['lists']['projects']) && $_SESSION['lists']['projects']) {
                 $current = getRequestVar('current', -1);
                 if ($current >= 0) {
                     $project = $_SESSION['lists']['projects']['list'][$current];
                 } else {
                     $current = 0;
                     foreach ($_SESSION['lists']['projects']['list'] as $project_from_list) {
                         if ($project_from_list->pid == $project_id) {
Exemplo n.º 3
0
         //$before = 'toc' ;
         //$args = array('id' => $proposal_id, 'before'=> $before, 'target'=> $container, 'replace_target'=> true);
         $proposal = Proposal::getInstance()->getProposalById($proposal_id, TRUE);
         if (!$proposal) {
             echo errorDiv(t('This proposal does not seem to exist!'));
             return;
         }
         if (Users::isStudent() && !Groups::isOwner(_PROPOSAL_OBJ, $proposal_id)) {
             echo errorDiv(t('You can only view your own proposals!'));
         } else {
             //TODO: find out whether we use the proposal view only in the my proposals and if not whether this
             //matters: non owners have no right to delete for example and so no reason to do a followup action
             echo renderProposal($proposal, $target, 'myproposal_page');
         }
     } else {
         echo errorDiv(t('No proposal identifier submitted!'));
     }
     break;
 case 'mark_proposal':
     $proposal_id = getRequestVar('proposal_id', 0, 'post');
     $project_id = getRequestVar('project_id', 0, 'post');
     $is_final = getRequestVar('is_final', 0, 'post');
     if (!$project_id) {
         echo t('The project could not be found');
         return;
     }
     if (!$proposal_id) {
         echo t('The proposal could not be found');
         return;
     }
     if (!$is_final) {
Exemplo n.º 4
0
module_load_include('php', 'vals_soc', 'includes/classes/Institutes');
module_load_include('php', 'vals_soc', 'includes/classes/Organisations');
switch ($_GET['action']) {
    case 'delete':
        if (!Users::isAdmin()) {
            echo errorDiv("You cannot delete comments");
        } else {
            $type = altSubValue($_POST, 'entity_type', '');
            $id = altSubValue($_POST, 'id', '');
            $entity_id = altSubValue($_POST, 'entity_id', '');
            try {
                $result = db_delete(tableName('comment'))->condition('id', $id);
            } catch (Exception $e) {
                echo "Error " . $e->getMessage();
            }
            echo $result ? successDiv(tt('You succesfully deleted your %1$s.', t('comment'))) : errorDiv(tt('We could not delete your %1%s.', t('comment')));
        }
        break;
    case 'save':
        global $user;
        $type = altSubValue($_POST, 'entity_type', '');
        $id = altSubValue($_POST, 'id', '');
        $entity_id = altSubValue($_POST, 'entity_id', '');
        $target = altSubValue($_POST, 'target', '');
        $properties = ThreadedComments::getInstance()->filterPostLite(ThreadedComments::getInstance()->getKeylessFields(), $_POST);
        $properties['author'] = $user->uid;
        $result = ThreadedComments::getInstance()->addComment($properties);
        $new = false;
        if ($result) {
            // get all the threads
            $thread_details = ThreadedComments::getInstance()->getThreadsForEntity($entity_id, $type);