Exemplo n.º 1
0
function showSuccess($msg = '')
{
    $msg .= showDrupalMessages('status');
    if ($msg) {
        echo successDiv($msg);
    }
}
Exemplo n.º 2
0
         foreach ($emails as $email) {
             if ($email) {
                 $mails[] = $mail;
                 $mails[$no]['to'] = $email;
                 $no++;
             }
         }
     } else {
         $mails[] = $mail;
         $mails[0]['to'] = $email;
     }
     // 		$mail['to'] = $email;//NEW
     // 		$mails[] = $mail;//NEW
     module_load_include('inc', 'vals_soc', 'includes/module/vals_soc.mail');
     if (vals_soc_send_emails_now($mails)) {
         echo successDiv(t('You sent your recommendation(s)'));
     } else {
         echo errorDiv(t('Something wrong with sending your recommendation(s): ') . getDrupalMessages('error'));
     }
     break;
 case 'rate':
     //do something
     if (!Users::isSuperVisor()) {
         echo t('You can only rate a project as supervisor.');
         return;
     }
     $rate = getRequestVar('rate');
     $id = getRequestVar('id');
     $table = tableName('supervisor_rate');
     $result = FALSE;
     $num_deleted = db_delete($table)->condition('pid', $id)->condition('uid', $GLOBALS['user']->uid)->execute();
Exemplo n.º 3
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);