Exemplo n.º 1
0
function connect_node_settings_form_validate($form, &$form_state)
{
    $child = NULL;
    $parent->nid = $form_state['values']['parent_id'];
    // required by connect_call_hooks
    $parent->data = $form_state['values'];
    connect_call_hooks($parent, $child, 'admin-validate', 'parent');
}
Exemplo n.º 2
0
/**
 * utility to re-send mail from participants with failed results
 **/
function _connect_action_send_email_resend_failed()
{
    $p_nid = arg(1);
    $parent = node_load($p_nid);
    if (!$parent || !connect_is_parent_node($parent)) {
        return;
    }
    $batch = (int) connect_node_options($parent->nid, 'email_batch');
    $done = 0;
    $report_header = array('participant email', 'result');
    $report_data = array();
    $sql = "SELECT nid FROM {connect_data} WHERE pid = %d";
    $result = db_query($sql, $p_nid);
    while ($row = db_fetch_object($result)) {
        $child = node_load($row->nid);
        if (connect_value('email_defined_result', $parent, $child, 'child') == "Failed") {
            //set lock to prevent connect_nodeapi from firing;
            $_SESSION['connect_child_lock_insert'] = TRUE;
            connect_call_hooks($parent, $child, 'insert');
            unset($_SESSION['connect_child_lock_insert']);
            $report_data[] = array(l(connect_value('email_from', $parent, $child, 'child'), 'node/' . $child->nid), connect_value('email_defined_result', $parent, $child, 'child'));
            $done++;
            if ($batch && $done >= $batch) {
                break;
            }
        }
    }
    if (empty($report_data)) {
        $output .= "<p>There were no failed emails to re-send.</p>\n";
    } else {
        $output = "<p>{$done} emails were re-sent</p>\n";
        $output .= theme_table($report_header, $report_data);
    }
    return $output;
}