Пример #1
0
function ciniki_conferences_reviewerGet($ciniki)
{
    //
    // Find all the required and optional arguments
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');
    $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'conference_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Conference'), 'reviewer_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Reviewer')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Make sure this module is activated, and
    // check permission to run this function for this business
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.reviewerGet');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Load business settings
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'intlSettings');
    $rc = ciniki_businesses_intlSettings($ciniki, $args['business_id']);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $intl_timezone = $rc['settings']['intl-default-timezone'];
    ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'datetimeFormat');
    $datetime_format = ciniki_users_datetimeFormat($ciniki, 'php');
    //
    // Load conference maps
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'maps');
    $rc = ciniki_conferences_maps($ciniki);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $maps = $rc['maps'];
    $reviewer = array();
    //
    // Get the customer details
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'customers', 'hooks', 'customerDetails');
    $rc = ciniki_customers_hooks_customerDetails($ciniki, $args['business_id'], array('customer_id' => $args['reviewer_id'], 'phones' => 'yes', 'emails' => 'yes', 'addresses' => 'no', 'subscriptions' => 'no'));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $reviewer['customer_details'] = $rc['details'];
    //
    // Lookup reviews
    //
    $strsql = "SELECT ciniki_conferences_presentation_reviews.id, " . "ciniki_conferences_presentation_reviews.conference_id, " . "ciniki_conferences_presentation_reviews.customer_id, " . "ciniki_conferences_presentations.title, " . "ciniki_conferences_presentations.presentation_number, " . "ciniki_customers.display_name, " . "ciniki_conferences_presentation_reviews.vote, " . "ciniki_conferences_presentation_reviews.vote AS vote_text " . "FROM ciniki_conferences_presentation_reviews " . "INNER JOIN ciniki_conferences_presentations ON (" . "ciniki_conferences_presentation_reviews.presentation_id = ciniki_conferences_presentations.id " . "AND ciniki_conferences_presentations.conference_id = '" . ciniki_core_dbQuote($ciniki, $args['conference_id']) . "' " . "AND ciniki_conferences_presentations.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "LEFT JOIN ciniki_customers ON (" . "ciniki_conferences_presentations.customer_id = ciniki_customers.id " . "AND ciniki_customers.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "WHERE ciniki_conferences_presentation_reviews.customer_id = '" . ciniki_core_dbQuote($ciniki, $args['reviewer_id']) . "' " . "AND ciniki_conferences_presentation_reviews.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "";
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
    $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'reviews', 'fname' => 'id', 'fields' => array('id', 'conference_id', 'customer_id', 'presentation_number', 'title', 'display_name', 'vote', 'vote_text'), 'maps' => array('vote_text' => $maps['presentationreview']['vote']))));
    if ($rc['stat'] != 'ok') {
        return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3251', 'msg' => 'Unable to get list of reviews', 'err' => $rc['err']));
    }
    if (isset($rc['reviews'])) {
        $reviewer['reviews'] = $rc['reviews'];
        foreach ($reviewer['reviews'] as $rid => $presentation) {
            $reviewer['reviews'][$rid]['display_title'] = sprintf("#%03d: ", $presentation['presentation_number']) . $presentation['title'];
        }
    } else {
        $reviewer['reviews'] = array();
    }
    //
    // Check for any messages sent
    //
    if (isset($ciniki['business']['modules']['ciniki.mail'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'mail', 'hooks', 'objectMessages');
        $rc = ciniki_mail_hooks_objectMessages($ciniki, $args['business_id'], array('object' => 'ciniki.conferences.conferencereviewer', 'object_id' => $args['conference_id'] . '-' . $args['reviewer_id']));
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if (isset($rc['messages'])) {
            $reviewer['messages'] = $rc['messages'];
        }
    }
    return array('stat' => 'ok', 'reviewer' => $reviewer);
}
Пример #2
0
function ciniki_conferences_presentationGet($ciniki)
{
    //
    // Find all the required and optional arguments
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');
    $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'presentation_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Presentation')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Make sure this module is activated, and
    // check permission to run this function for this business
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.presentationGet');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Load business settings
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'intlSettings');
    $rc = ciniki_businesses_intlSettings($ciniki, $args['business_id']);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $intl_timezone = $rc['settings']['intl-default-timezone'];
    $intl_currency_fmt = numfmt_create($rc['settings']['intl-default-locale'], NumberFormatter::CURRENCY);
    $intl_currency = $rc['settings']['intl-default-currency'];
    ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'datetimeFormat');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'dateFormat');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'timeFormat');
    $datetime_format = ciniki_users_datetimeFormat($ciniki, 'php');
    $date_format = ciniki_users_dateFormat($ciniki, 'php');
    $time_format = ciniki_users_timeFormat($ciniki, 'php');
    //
    // Load conference maps
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'maps');
    $rc = ciniki_conferences_maps($ciniki);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $maps = $rc['maps'];
    //
    // Return default for new Presentation
    //
    if ($args['presentation_id'] == 0) {
        $presentation = array('id' => 0, 'conference_id' => '', 'customer_id' => '', 'session_id' => 0, 'presentation_number' => '', 'presentation_type' => '', 'status' => '10', 'registration' => '0', 'submission_date' => '', 'field' => '', 'title' => '', 'permalink' => '', 'description' => '');
        $sessions = array();
    } else {
        $strsql = "SELECT ciniki_conferences_presentations.id, " . "ciniki_conferences_presentations.conference_id, " . "ciniki_conferences_presentations.customer_id, " . "ciniki_conferences_presentations.session_id, " . "ciniki_customers.display_name, " . "ciniki_conferences_presentations.presentation_number, " . "ciniki_conferences_presentations.presentation_type, " . "ciniki_conferences_presentations.presentation_type AS presentation_type_text, " . "ciniki_conferences_presentations.status, " . "ciniki_conferences_presentations.status AS status_text, " . "IFNULL(ciniki_conferences_attendees.status, 0) AS registration, " . "IFNULL(ciniki_conferences_attendees.status, 0) AS registration_text, " . "ciniki_conferences_presentations.submission_date, " . "ciniki_conferences_presentations.field, " . "ciniki_conferences_presentations.title, " . "ciniki_conferences_presentations.permalink, " . "ciniki_conferences_presentations.description " . "FROM ciniki_conferences_presentations " . "LEFT JOIN ciniki_conferences_attendees ON (" . "ciniki_conferences_presentations.customer_id = ciniki_conferences_attendees.customer_id " . "AND ciniki_conferences_attendees.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "LEFT JOIN ciniki_customers ON (" . "ciniki_conferences_presentations.customer_id = ciniki_customers.id " . "AND ciniki_customers.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "WHERE ciniki_conferences_presentations.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_presentations.id = '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . "";
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
        $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'presentations', 'fname' => 'id', 'fields' => array('id', 'conference_id', 'customer_id', 'session_id', 'display_name', 'presentation_number', 'presentation_type', 'presentation_type_text', 'status', 'status_text', 'registration', 'registration_text', 'submission_date', 'field', 'title', 'permalink', 'description'), 'maps' => array('presentation_type_text' => $maps['presentation']['presentation_type'], 'status_text' => $maps['presentation']['status'], 'registration_text' => $maps['attendee']['status']), 'utctotz' => array('submission_date' => array('format' => $datetime_format, 'timezone' => $intl_timezone)))));
        if ($rc['stat'] != 'ok') {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3081', 'msg' => 'Presentation not found', 'err' => $rc['err']));
        }
        if (!isset($rc['presentations'][0])) {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3082', 'msg' => 'Unable to find Presentation'));
        }
        $presentation = $rc['presentations'][0];
        $presentation['display_title'] = sprintf("#%03d: ", $presentation['presentation_number']) . $presentation['title'];
        //
        // Get the customer details
        //
        ciniki_core_loadMethod($ciniki, 'ciniki', 'customers', 'hooks', 'customerDetails');
        $rc = ciniki_customers_hooks_customerDetails($ciniki, $args['business_id'], array('customer_id' => $presentation['customer_id'], 'phones' => 'yes', 'emails' => 'yes', 'addresses' => 'no', 'subscriptions' => 'no', 'full_bio' => 'yes'));
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        $presentation['customer_details'] = $rc['details'];
        if (isset($rc['customer']['full_bio'])) {
            $presentation['full_bio'] = $rc['customer']['full_bio'];
        } else {
            $presentation['full_bio'] = '';
        }
        //
        // Lookup reviews
        //
        $strsql = "SELECT ciniki_conferences_presentation_reviews.id, " . "ciniki_conferences_presentation_reviews.conference_id, " . "ciniki_conferences_presentation_reviews.customer_id, " . "ciniki_customers.display_name, " . "ciniki_conferences_presentation_reviews.vote, " . "ciniki_conferences_presentation_reviews.vote AS vote_text " . "FROM ciniki_conferences_presentation_reviews " . "LEFT JOIN ciniki_customers ON (" . "ciniki_conferences_presentation_reviews.customer_id = ciniki_customers.id " . "AND ciniki_customers.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "WHERE ciniki_conferences_presentation_reviews.presentation_id = '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . "AND ciniki_conferences_presentation_reviews.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "";
        $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'reviews', 'fname' => 'id', 'fields' => array('id', 'conference_id', 'customer_id', 'display_name', 'vote', 'vote_text'), 'maps' => array('vote_text' => $maps['presentationreview']['vote']))));
        if ($rc['stat'] != 'ok') {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3188', 'msg' => 'Unable to get list of reviews', 'err' => $rc['err']));
        }
        if (isset($rc['reviews'])) {
            $presentation['reviews'] = $rc['reviews'];
        } else {
            $presentation['reviews'] = array();
        }
        //
        // Get the list of sessions
        //
        $strsql = "SELECT ciniki_conferences_sessions.id, " . "ciniki_conferences_sessions.conference_id, " . "ciniki_conferences_sessions.room_id, " . "ciniki_conferences_sessions.name, " . "ciniki_conferences_rooms.name AS room, " . "ciniki_conferences_rooms.sequence, " . "ciniki_conferences_sessions.session_start AS start_time, " . "ciniki_conferences_sessions.session_start AS start_date, " . "ciniki_conferences_sessions.session_end AS end_time " . "FROM ciniki_conferences_sessions " . "LEFT JOIN ciniki_conferences_rooms ON (" . "ciniki_conferences_sessions.room_id = ciniki_conferences_rooms.id " . "AND ciniki_conferences_rooms.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "WHERE ciniki_conferences_sessions.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_sessions.conference_id = '" . ciniki_core_dbQuote($ciniki, $presentation['conference_id']) . "' " . "";
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
        $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'sessions', 'fname' => 'id', 'fields' => array('id', 'conference_id', 'room', 'room_id', 'name', 'sequence', 'start_time', 'start_date', 'end_time'), 'utctotz' => array('start_time' => array('format' => $time_format, 'timezone' => $intl_timezone), 'start_date' => array('format' => $date_format, 'timezone' => $intl_timezone), 'end_time' => array('format' => $time_format, 'timezone' => $intl_timezone)))));
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if (isset($rc['sessions'])) {
            $sessions = $rc['sessions'];
            foreach ($sessions as $sid => $session) {
                $sessions[$sid]['display_name'] = $session['name'];
                if ($session['room'] != '') {
                    $sessions[$sid]['display_name'] .= ($sessions[$sid]['display_name'] != '' ? ' - ' : '') . $session['room'];
                }
                $sessions[$sid]['display_name'] .= ($sessions[$sid]['display_name'] != '' ? ' - ' : '') . $session['start_time'] . ' - ' . $session['end_time'] . ', ' . $session['start_date'];
            }
        } else {
            $sessions = array();
        }
    }
    return array('stat' => 'ok', 'presentation' => $presentation, 'sessions' => $sessions);
}
Пример #3
0
function ciniki_conferences_attendeeGet($ciniki)
{
    //
    // Find all the required and optional arguments
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');
    $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'attendee_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Attendee'), 'customer_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Customer')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Make sure this module is activated, and
    // check permission to run this function for this business
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.attendeeGet');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Load business settings
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'intlSettings');
    $rc = ciniki_businesses_intlSettings($ciniki, $args['business_id']);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $intl_timezone = $rc['settings']['intl-default-timezone'];
    $intl_currency_fmt = numfmt_create($rc['settings']['intl-default-locale'], NumberFormatter::CURRENCY);
    $intl_currency = $rc['settings']['intl-default-currency'];
    ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'datetimeFormat');
    $datetime_format = ciniki_users_datetimeFormat($ciniki, 'php');
    //
    // Return default for new Attendee
    //
    if ($args['attendee_id'] == 0) {
        $attendee = array('id' => 0, 'conference_id' => '', 'customer_id' => isset($args['customer_id']) ? $args['customer_id'] : 0, 'status' => '0');
    } else {
        $strsql = "SELECT ciniki_conferences_attendees.id, " . "ciniki_conferences_attendees.conference_id, " . "ciniki_conferences_attendees.customer_id, " . "ciniki_conferences_attendees.status " . "FROM ciniki_conferences_attendees " . "WHERE ciniki_conferences_attendees.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_attendees.id = '" . ciniki_core_dbQuote($ciniki, $args['attendee_id']) . "' " . "";
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'attendee');
        if ($rc['stat'] != 'ok') {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3501', 'msg' => 'Attendee not found', 'err' => $rc['err']));
        }
        if (!isset($rc['attendee'])) {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3502', 'msg' => 'Unable to find Attendee'));
        }
        $attendee = $rc['attendee'];
    }
    if ($attendee['customer_id'] > 0) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'customers', 'hooks', 'customerDetails');
        $rc = ciniki_customers_hooks_customerDetails($ciniki, $args['business_id'], array('customer_id' => $attendee['customer_id'], 'phones' => 'yes', 'emails' => 'yes'));
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        $attendee['customer'] = $rc['customer'];
        $attendee['customer_details'] = $rc['details'];
    }
    return array('stat' => 'ok', 'attendee' => $attendee);
}
Пример #4
0
function ciniki_conferences_presentationReviewGet($ciniki)
{
    //
    // Find all the required and optional arguments
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');
    $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'review_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Presentation Review')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Make sure this module is activated, and
    // check permission to run this function for this business
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.presentationReviewGet');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Load business settings
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'intlSettings');
    $rc = ciniki_businesses_intlSettings($ciniki, $args['business_id']);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $intl_timezone = $rc['settings']['intl-default-timezone'];
    $intl_currency_fmt = numfmt_create($rc['settings']['intl-default-locale'], NumberFormatter::CURRENCY);
    $intl_currency = $rc['settings']['intl-default-currency'];
    ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'datetimeFormat');
    $datetime_format = ciniki_users_datetimeFormat($ciniki, 'php');
    //
    // Load conference maps
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'maps');
    $rc = ciniki_conferences_maps($ciniki);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $maps = $rc['maps'];
    //
    // Return default for new Presentation Review
    //
    if ($args['review_id'] == 0) {
        $presentationreview = array('id' => 0, 'conference_id' => '', 'presentation_id' => '', 'customer_id' => '', 'vote' => '0', 'notes' => '');
    } else {
        $strsql = "SELECT ciniki_conferences_presentation_reviews.id, " . "ciniki_conferences_presentation_reviews.conference_id, " . "ciniki_conferences_presentation_reviews.presentation_id, " . "ciniki_conferences_presentation_reviews.customer_id, " . "ciniki_conferences_presentation_reviews.vote, " . "ciniki_conferences_presentation_reviews.notes " . "FROM ciniki_conferences_presentation_reviews " . "WHERE ciniki_conferences_presentation_reviews.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_presentation_reviews.id = '" . ciniki_core_dbQuote($ciniki, $args['review_id']) . "' " . "";
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'presentationreview');
        if ($rc['stat'] != 'ok') {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3247', 'msg' => 'Presentation Review not found', 'err' => $rc['err']));
        }
        if (!isset($rc['presentationreview'])) {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3248', 'msg' => 'Unable to find Presentation Review'));
        }
        $presentationreview = $rc['presentationreview'];
        //
        // Get the customer details
        //
        ciniki_core_loadMethod($ciniki, 'ciniki', 'customers', 'hooks', 'customerDetails');
        $rc = ciniki_customers_hooks_customerDetails($ciniki, $args['business_id'], array('customer_id' => $presentationreview['customer_id'], 'phones' => 'yes', 'emails' => 'yes', 'addresses' => 'no', 'subscriptions' => 'no'));
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        $presentationreview['customer_details'] = $rc['details'];
        //
        // Get the presentation details
        //
        $strsql = "SELECT ciniki_conferences_presentations.id, " . "ciniki_conferences_presentations.conference_id, " . "ciniki_conferences_presentations.customer_id, " . "ciniki_customers.display_name, " . "ciniki_conferences_presentations.presentation_number, " . "ciniki_conferences_presentations.presentation_type, " . "ciniki_conferences_presentations.presentation_type AS presentation_type_text, " . "ciniki_conferences_presentations.status, " . "ciniki_conferences_presentations.status AS status_text, " . "ciniki_conferences_presentations.title, " . "ciniki_conferences_presentations.field, " . "ciniki_conferences_presentations.submission_date " . "FROM ciniki_conferences_presentations " . "LEFT JOIN ciniki_customers ON (" . "ciniki_conferences_presentations.customer_id = ciniki_customers.id " . "AND ciniki_customers.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "WHERE ciniki_conferences_presentations.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_presentations.id = '" . ciniki_core_dbQuote($ciniki, $presentationreview['presentation_id']) . "' " . "";
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
        $rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'presentations', 'fname' => 'id', 'fields' => array('id', 'conference_id', 'display_name', 'customer_id', 'presentation_number', 'presentation_type', 'presentation_type_text', 'status', 'status_text', 'submission_date', 'field', 'title'), 'maps' => array('presentation_type_text' => $maps['presentation']['presentation_type'], 'status_text' => $maps['presentation']['status']), 'utctotz' => array('submission_date' => array('format' => $datetime_format, 'timezone' => $intl_timezone)))));
        if ($rc['stat'] != 'ok') {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3249', 'msg' => 'Presentation not found', 'err' => $rc['err']));
        }
        if (!isset($rc['presentations'][0])) {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3250', 'msg' => 'Unable to find Presentation'));
        }
        $presentation = $rc['presentations'][0];
        $presentationreview['presentation_details'] = array(array('label' => 'Title', 'value' => sprintf("#%03d: ", $presentation['presentation_number']) . $presentation['title']), array('label' => 'Field', 'value' => $presentation['field']), array('label' => 'Presenter', 'value' => $presentation['display_name']));
    }
    return array('stat' => 'ok', 'review' => $presentationreview);
}
Пример #5
0
function ciniki_conferences_reviewerPDF(&$ciniki)
{
    //
    // Find all the required and optional arguments
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'prepareArgs');
    $rc = ciniki_core_prepareArgs($ciniki, 'no', array('business_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Business'), 'conference_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Conference'), 'reviewer_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Reviewer'), 'subject' => array('required' => 'no', 'blank' => 'yes', 'default' => '', 'name' => 'Message Subject'), 'content' => array('required' => 'no', 'blank' => 'yes', 'default' => '', 'name' => 'Message Content'), 'email' => array('required' => 'no', 'blank' => 'yes', 'default' => 'no', 'name' => 'Email PDF')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Make sure this module is activated, and
    // check permission to run this function for this business
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.reviewerPDF');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Get the reviewer details
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'customers', 'hooks', 'customerDetails');
    $rc = ciniki_customers_hooks_customerDetails($ciniki, $args['business_id'], array('customer_id' => $args['reviewer_id'], 'phones' => 'no', 'emails' => 'yes', 'addresses' => 'no', 'subscriptions' => 'no'));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $reviewer = $rc['customer'];
    $customer_email = '';
    if (isset($rc['customer']['emails'][0]['email']['address'])) {
        $customer_email = $rc['customer']['emails'][0]['email']['address'];
    }
    //
    // Generate the PDF
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'templates', 'reviewerPresentationsPDF');
    $rc = ciniki_conferences_templates_reviewerPresentationsPDF($ciniki, $args['business_id'], $args['reviewer_id'], $args['conference_id']);
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $conference = $rc['conference'];
    $title = $reviewer['display_name'] . '-' . $conference['name'];
    $filename = preg_replace('/[^a-zA-Z0-9_]/', '', preg_replace('/ /', '_', $title));
    if (isset($rc['pdf'])) {
        $pdf = $rc['pdf'];
        if ($args['email'] == 'yes' && $args['subject'] != '' && $args['content'] != '') {
            if ($customer_email == '') {
                return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3376', 'msg' => 'No email specified for this reviewer'));
            }
            //
            // Add to the mail module
            //
            ciniki_core_loadMethod($ciniki, 'ciniki', 'mail', 'hooks', 'addMessage');
            $rc = ciniki_mail_hooks_addMessage($ciniki, $args['business_id'], array('object' => 'ciniki.conferences.conferencereviewer', 'object_id' => $args['conference_id'] . '-' . $args['reviewer_id'], 'customer_id' => $args['reviewer_id'], 'customer_email' => $customer_email, 'customer_name' => isset($reviewer['display_name']) ? $reviewer['display_name'] : '', 'subject' => $args['subject'], 'html_content' => $args['content'], 'text_content' => $args['content'], 'attachments' => array(array('content' => $pdf->Output('invoice', 'S'), 'filename' => $filename . '.pdf'))));
            if ($rc['stat'] != 'ok') {
                ciniki_core_dbTransactionRollback($ciniki, 'ciniki.mail');
                return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3377', 'msg' => 'Unable to create mail message.', 'err' => $rc['err']));
            }
            $ciniki['emailqueue'][] = array('mail_id' => $rc['id'], 'business_id' => $args['business_id']);
            return array('stat' => 'ok');
        } else {
            $rc['pdf']->Output($filename . '.pdf', 'D');
        }
    }
    return array('stat' => 'exit');
}