コード例 #1
0
function showSuccess($msg = '')
{
    $msg .= showDrupalMessages('status');
    if ($msg) {
        echo successDiv($msg);
    }
}
コード例 #2
0
     break;
 case 'save':
     $type = altSubValue($_POST, 'type', '');
     $id = altSubValue($_POST, 'id', '');
     $draft = altSubValue($_POST, 'draft', false);
     $properties = Project::getInstance()->filterPostLite(Project::getInstance()->getKeylessFields(), $_POST);
     $properties['state'] = $draft ? 'draft' : 'pending';
     if (!$id) {
         $new = $properties['org_id'];
         $result = Project::getInstance()->addProject($properties);
     } else {
         $new = false;
         $result = Project::getInstance()->changeProject($properties, $id);
     }
     if ($result) {
         echo json_encode(array('result' => TRUE, 'id' => $id, 'type' => $type, 'new_tab' => !$id ? $properties['org_id'] : 0, 'extra' => $mine ? array('mine' => 1) : '', 'msg' => ($id ? tt('You succesfully changed the data of your %1$s', t_type($type)) : tt('You succesfully added your %1$s', t_type($type))) . (_DEBUG ? showDrupalMessages() : '')));
     } else {
         echo jsonBadResult();
     }
     break;
 case 'show':
     $show_last = altSubValue($_POST, 'new_tab', false);
     $owner_only = altSubValue($_POST, 'mine', false);
     showProjectPage($show_last, $owner_only);
     break;
 case 'edit':
     $type = altSubValue($_POST, 'type', '');
     $id = altSubValue($_POST, 'id', '');
     $target = altSubValue($_POST, 'target', '');
     $obj = Project::getProjectById($id, FALSE, NULL);
     if (!$obj) {
コード例 #3
0
                 /// newly inserted
                 $existed = false;
                 $key = $result;
             }
             try {
                 $props = Proposal::getInstance()->getProposalById($key, true);
                 module_load_include('inc', 'vals_soc', 'includes/module/vals_soc.mail');
                 notify_mentor_and_supervisor_of_proposal_update($props, $existed);
             } catch (Exception $e) {
                 // Logged higher up or log this here somehow? TODO
             }
             if (isset($is_final) && $is_final) {
                 echo json_encode(array('result' => 'OK', 'id' => $id, 'target' => $target, 'msg' => tt('You succesfully submitted your proposal for %1$s', $project['title']) . (_DEBUG ? showDrupalMessages() : '')));
             } else {
                 $version = $properties['state'] == 'draft' ? t('draft') : t('public');
                 echo json_encode(array('result' => 'OK', 'id' => $id, 'msg' => ($new ? tt('You succesfully saved a %2$s version of your proposal for %1$s', $project['title'], $version) : tt('You succesfully changed the %2$s version of your proposal for %1$s', $project['title'], $version)) . (_DEBUG ? showDrupalMessages() : '')));
             }
         } else {
             echo jsonBadResult();
         }
     }
     break;
 case 'reject_form':
     $target = getRequestVar('target');
     renderForm(drupal_get_form('vals_soc_reject_form', getRequestVar('id', 0), $target), $target);
     break;
 case 'reject':
     $id = getRequestVar('id', 0, 'post');
     $reason = getRequestVar('reason', '', 'post');
     $rationale = getRequestVar('rationale', '', 'post');
     try {
コード例 #4
0
        }
        break;
    case 'save':
        $type = altSubValue($_POST, 'type', '');
        $id = altSubValue($_POST, 'id', '');
        $show_action = altSubValue($_POST, 'show_action', '');
        //TODO do some checks here
        if (!isValidOrganisationType($type)) {
            //&& ($type !== _PROJECT_OBJ)
            $result = NULL;
            drupal_set_message(tt('This is not a valid type: %s', $type), 'error');
            echo jsonBadResult();
            return;
        }
        $properties = Groups::filterPostByType($type, $_POST);
        if (!$id) {
            $new = true;
            $result = $type == _STUDENT_GROUP ? Groups::addStudentGroup($properties) : ($type == _PROJECT_OBJ ? Project::getInstance()->addProject($properties) : Groups::addGroup($properties, $type));
        } else {
            $new = false;
            $result = Groups::changeGroup($type, $properties, $id);
        }
        if ($result) {
            echo json_encode(array('result' => TRUE, 'id' => $id, 'type' => $type, 'new_tab' => !$id ? $result : 0, 'show_action' => $show_action, 'msg' => ($id ? tt('You succesfully changed the data of your %1$s', t_type($type)) : tt('You succesfully added your %1$s', t_type($type))) . (_DEBUG ? showDrupalMessages() : '')));
        } else {
            echo jsonBadResult();
        }
        break;
    default:
        echo "No such action: " . $_GET['action'];
}
コード例 #5
0
             if ($type == _PROPOSAL_OBJ) {
                 $entity_details = objectToArray(Proposal::getInstance()->getProposalById($entity_id, true));
                 $fire_emails = true;
             } else {
                 // for now nothing - only have projects & proposal comments
                 $fire_emails = false;
             }
         }
         // send emails out...
         if ($fire_emails) {
             $properties['name'] = $user->name;
             $properties['mail'] = $user->mail;
             module_load_include('inc', 'vals_soc', 'includes/module/vals_soc.mail');
             notify_all_of_new_comment($entity_details, $thread_details, $properties);
         }
         echo json_encode(array('result' => TRUE, 'id' => $result, 'type' => $type, 'entity_id' => $entity_id, 'msg' => tt('You succesfully added a comment to this %1$s', t_type($type)) . (_DEBUG ? showDrupalMessages() : '')));
     } else {
         echo jsonBadResult();
     }
     break;
 case 'view':
     $type = altSubValue($_POST, 'type', 'comment');
     $id = altSubValue($_POST, 'id');
     $target = altSubValue($_POST, 'target', '');
     if (!($id && $type && $target)) {
         die(t('There are missing arguments. Please inform the administrator of this mistake.'));
     }
     $post = ThreadedComments::getInstance()->getPostById($id);
     if (!$post) {
         echo tt('The post for this %1$s cannot be found', t_type($type));
     } else {