当前位置: 首页>>代码示例>>PHP>>正文


PHP ciniki_core_dbTransactionRollback函数代码示例

本文整理汇总了PHP中ciniki_core_dbTransactionRollback函数的典型用法代码示例。如果您正苦于以下问题:PHP ciniki_core_dbTransactionRollback函数的具体用法?PHP ciniki_core_dbTransactionRollback怎么用?PHP ciniki_core_dbTransactionRollback使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ciniki_core_dbTransactionRollback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ciniki_conferences_roomUpdate

function ciniki_conferences_roomUpdate(&$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'), 'room_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Conference Room'), 'conference_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Conference'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'sequence' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Order')));
    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.roomUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the Conference Room in the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate');
    $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.room', $args['room_id'], $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences');
    //
    // Update the web index if enabled
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec');
    ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.conferences.room', 'object_id' => $args['room_id']));
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:conferences,代码行数:60,代码来源:roomUpdate.php

示例2: ciniki_conferences_sessionAdd

function ciniki_conferences_sessionAdd(&$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'), 'room_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Room'), 'name' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Name'), 'session_start' => array('required' => 'yes', 'blank' => 'no', 'type' => 'datetimetoutc', 'name' => 'Start'), 'session_end' => array('required' => 'yes', 'blank' => 'no', 'type' => 'datetimetoutc', 'name' => 'End')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.sessionAdd');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Add the conference session to the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
    $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.conferences.session', $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    $session_id = $rc['id'];
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences');
    //
    // Update the web index if enabled
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec');
    ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.conferences.session', 'object_id' => $session_id));
    return array('stat' => 'ok', 'id' => $session_id);
}
开发者ID:ciniki,项目名称:conferences,代码行数:60,代码来源:sessionAdd.php

示例3: ciniki_conferences_presentationReviewAdd

function ciniki_conferences_presentationReviewAdd(&$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'), 'presentation_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Presentation'), 'customer_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Reviewer'), 'vote' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Vote'), 'notes' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Notes')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.presentationReviewAdd');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Add the presentation review to the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
    $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.conferences.presentationreview', $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    $review_id = $rc['id'];
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences');
    return array('stat' => 'ok', 'id' => $review_id);
}
开发者ID:ciniki,项目名称:conferences,代码行数:55,代码来源:presentationReviewAdd.php

示例4: ciniki_merchandise_productDeleteObjRef

function ciniki_merchandise_productDeleteObjRef(&$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'), 'objref_id' => array('required' => 'yes', 'blank' => 'yes', 'name' => 'Reference')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'merchandise', 'private', 'checkAccess');
    $rc = ciniki_merchandise_checkAccess($ciniki, $args['business_id'], 'ciniki.merchandise.productDeleteObjRef');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDelete');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectDelete');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.merchandise');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $rc = ciniki_core_objectDelete($ciniki, $args['business_id'], 'ciniki.merchandise.objref', $args['objref_id'], $ref_row['uuid'], 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise');
        return $rc;
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.merchandise');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'merchandise');
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:merchandise,代码行数:52,代码来源:productDeleteObjRef.php

示例5: ciniki_conferences_conferenceAdd

function ciniki_conferences_conferenceAdd(&$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'), 'name' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Name'), 'permalink' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Permalink'), 'status' => array('required' => 'no', 'blank' => 'no', 'name' => 'Status'), 'flags' => array('required' => 'no', 'blank' => 'no', 'name' => 'Flags'), 'start_date' => array('required' => 'yes', 'blank' => 'no', 'type' => 'date', 'name' => 'Start Date'), 'end_date' => array('required' => 'yes', 'blank' => 'no', 'type' => 'date', 'name' => 'End Date'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'imap_mailbox' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Mailbox'), 'imap_username' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Username'), 'imap_password' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Password'), 'imap_subject' => array('required' => 'no', 'blank' => 'yes', 'name' => 'IMAP Subject')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.conferenceAdd');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Setup permalink
    //
    if (!isset($args['permalink']) || $args['permalink'] == '') {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
        $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']);
    }
    //
    // Check the permalink doesn't already exist
    //
    $strsql = "SELECT id " . "FROM ciniki_conferences " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "";
    $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'conference');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if ($rc['num_rows'] > 0) {
        return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2839', 'msg' => 'You already have a conference with this name, please choose another name.'));
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Add the conference to the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
    $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.conferences.conference', $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    $conference_id = $rc['id'];
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences');
    return array('stat' => 'ok', 'id' => $conference_id);
}
开发者ID:ciniki,项目名称:conferences,代码行数:73,代码来源:conferenceAdd.php

示例6: ciniki_conferences_attendeeDelete

function ciniki_conferences_attendeeDelete(&$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' => 'yes', 'name' => 'Attendee')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.attendeeDelete');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Get the current settings for the attendee
    //
    $strsql = "SELECT id, uuid, customer_id " . "FROM ciniki_conferences_attendees " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['attendee_id']) . "' " . "";
    $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'attendee');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if (!isset($rc['attendee'])) {
        return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3500', 'msg' => 'Attendee does not exist.'));
    }
    $attendee = $rc['attendee'];
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDelete');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectDelete');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Remove the attendee
    //
    $rc = ciniki_core_objectDelete($ciniki, $args['business_id'], 'ciniki.conferences.attendee', $args['attendee_id'], $attendee['uuid'], 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences');
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:conferences,代码行数:67,代码来源:attendeeDelete.php

示例7: ciniki_artistprofiles_artistAdd

function ciniki_artistprofiles_artistAdd(&$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'), 'name' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Name'), 'subname' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Sub Name'), 'sort_name' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Sort Name'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'status' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Status'), 'flags' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Options'), 'primary_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Primary Image'), 'primary_image_caption' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Primary Image Caption'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'setup_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Setup Image'), 'setup_image_caption' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Setup Image Caption'), 'setup_description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'categories' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Categories')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'checkAccess');
    $rc = ciniki_artistprofiles_checkAccess($ciniki, $args['business_id'], 'ciniki.artistprofiles.artistAdd');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // If not specified, setup the sort name
    //
    if (!isset($args['sort_name']) || $args['sort_name'] == '') {
        $args['sort_name'] = $args['name'];
    }
    //
    // Setup permalink
    //
    if (!isset($args['permalink']) || $args['permalink'] == '') {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
        $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']);
    }
    //
    // Make sure the permalink is unique
    //
    $strsql = "SELECT id, name, permalink " . "FROM ciniki_artistprofiles " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "";
    $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.events', 'event');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if ($rc['num_rows'] > 0) {
        return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2888', 'msg' => 'You already have an artist with this name, please choose another name'));
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Add the artist to the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
    $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.artistprofiles.artist', $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
        return $rc;
    }
    $artist_id = $rc['id'];
    //
    // Update the categories
    //
    if (isset($args['categories'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate');
        $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.artistprofiles', 'tag', $args['business_id'], 'ciniki_artistprofiles_tags', 'ciniki_artistprofiles_history', 'artist_id', $artist_id, 10, $args['categories']);
        if ($rc['stat'] != 'ok') {
            ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
            return $rc;
        }
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'artistprofiles');
    //
    // Update the web index if enabled
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec');
    ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.artistprofiles.artist', 'object_id' => $artist_id));
    return array('stat' => 'ok', 'id' => $artist_id);
}
开发者ID:ciniki,项目名称:artistprofiles,代码行数:95,代码来源:artistAdd.php

示例8: ciniki_artistprofiles_settingsUpdate

function ciniki_artistprofiles_settingsUpdate(&$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')));
    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', 'artistprofiles', 'private', 'checkAccess');
    $rc = ciniki_artistprofiles_checkAccess($ciniki, $args['business_id'], 'ciniki.artistprofiles.settingsUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Turn off autocommit
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbInsert');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // The list of allowed fields for updating
    //
    $changelog_fields = array('dropbox-artistprofiles');
    //
    // Check each valid setting and see if a new value was passed in the arguments for it.
    // Insert or update the entry in the ciniki_artistprofiles_settings table
    //
    foreach ($changelog_fields as $field) {
        if (isset($ciniki['request']['args'][$field])) {
            $strsql = "INSERT INTO ciniki_artistprofiles_settings (business_id, detail_key, detail_value, date_added, last_updated) " . "VALUES ('" . ciniki_core_dbQuote($ciniki, $ciniki['request']['args']['business_id']) . "'" . ", '" . ciniki_core_dbQuote($ciniki, $field) . "'" . ", '" . ciniki_core_dbQuote($ciniki, $ciniki['request']['args'][$field]) . "'" . ", UTC_TIMESTAMP(), UTC_TIMESTAMP()) " . "ON DUPLICATE KEY UPDATE detail_value = '" . ciniki_core_dbQuote($ciniki, $ciniki['request']['args'][$field]) . "' " . ", last_updated = UTC_TIMESTAMP() " . "";
            $rc = ciniki_core_dbInsert($ciniki, $strsql, 'ciniki.artistprofiles');
            if ($rc['stat'] != 'ok') {
                ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
                return $rc;
            }
            ciniki_core_dbAddModuleHistory($ciniki, 'ciniki.artistprofiles', 'ciniki_artistprofiles_history', $args['business_id'], 2, 'ciniki_artistprofiles_settings', $field, 'detail_value', $ciniki['request']['args'][$field]);
            $ciniki['syncqueue'][] = array('push' => 'ciniki.artistprofiles.setting', 'args' => array('id' => $field));
        }
    }
    //
    // Commit the database changes
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'artistprofiles');
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:artistprofiles,代码行数:68,代码来源:settingsUpdate.php

示例9: ciniki_artistprofiles_categoryUpdate

function ciniki_artistprofiles_categoryUpdate(&$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'), 'category' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Category'), 'title' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Title'), 'sequence' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Sequence'), 'image' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Image'), 'content' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Content')));
    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', 'artistprofiles', 'private', 'checkAccess');
    $rc = ciniki_artistprofiles_checkAccess($ciniki, $args['business_id'], 'ciniki.artistprofiles.categoryUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Grab the settings for the business from the database
    //
    $strsql = "SELECT detail_key, detail_value " . "FROM ciniki_artistprofiles_settings " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND detail_key LIKE 'tag-category-%-" . ciniki_core_dbQuote($ciniki, $args['category']) . "' " . "";
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQueryList2');
    $rc = ciniki_core_dbQueryList2($ciniki, $strsql, 'ciniki.artistprofiles', 'settings');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $settings = array();
    if (isset($rc['settings'])) {
        $settings = $rc['settings'];
    }
    //
    // Turn off autocommit
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbInsert');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUpdate');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // The list of allowed fields for updating
    //
    $changelog_fields = array('title', 'sequence', 'image', 'content');
    //
    // Check each valid setting and see if a new value was passed in the arguments for it.
    // Insert or update the entry in the ciniki_artistprofiles_settings table
    //
    foreach ($changelog_fields as $field) {
        if (isset($args[$field])) {
            if (isset($settings['tag-category-' . $field . '-' . $args['category']])) {
                // Update the settings
                if ($settings['tag-category-' . $field . '-' . $args['category']] != $args[$field]) {
                    $strsql = "UPDATE ciniki_artistprofiles_settings " . "SET detail_value = '" . ciniki_core_dbQuote($ciniki, $args[$field]) . "' " . ", last_updated = UTC_TIMESTAMP() " . "WHERE detail_key = 'tag-category-" . ciniki_core_dbQuote($ciniki, $field . "-" . $args['category']) . "' " . "";
                    $rc = ciniki_core_dbInsert($ciniki, $strsql, 'ciniki.artistprofiles');
                    if ($rc['stat'] != 'ok') {
                        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
                        return $rc;
                    }
                    ciniki_core_dbAddModuleHistory($ciniki, 'ciniki.artistprofiles', 'ciniki_artistprofiles_history', $args['business_id'], 2, 'ciniki_artistprofiles_settings', 'tag-category-' . $field . '-' . $args['category'], 'detail_value', $args[$field]);
                    $ciniki['syncqueue'][] = array('push' => 'ciniki.artistprofiles.setting', 'args' => array('id' => 'tag-category-' . $field . '-' . $args['category']));
                }
            } else {
                // Add the setting
                $strsql = "INSERT INTO ciniki_artistprofiles_settings (business_id, detail_key, detail_value, date_added, last_updated) " . "VALUES ('" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "'" . ", 'tag-category-" . ciniki_core_dbQuote($ciniki, $field . '-' . $args['category']) . "' " . ", '" . ciniki_core_dbQuote($ciniki, $args[$field]) . "'" . ", UTC_TIMESTAMP(), UTC_TIMESTAMP()) ";
                $rc = ciniki_core_dbUpdate($ciniki, $strsql, 'ciniki.artistprofiles');
                if ($rc['stat'] != 'ok') {
                    ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
                    return $rc;
                }
                ciniki_core_dbAddModuleHistory($ciniki, 'ciniki.artistprofiles', 'ciniki_artistprofiles_history', $args['business_id'], 1, 'ciniki_artistprofiles_settings', 'tag-category-' . $field . '-' . $args['category'], 'detail_value', $args[$field]);
                $ciniki['syncqueue'][] = array('push' => 'ciniki.artistprofiles.setting', 'args' => array('id' => 'tag-category-' . $field . '-' . $args['category']));
            }
        }
    }
    //
    // Commit the database changes
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'artistprofiles');
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:artistprofiles,代码行数:97,代码来源:categoryUpdate.php

示例10: ciniki_artistprofiles_linkUpdate

function ciniki_artistprofiles_linkUpdate(&$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'), 'link_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Link'), 'artist_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Artist'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'url' => array('required' => 'no', 'blank' => 'no', 'name' => 'URL'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description')));
    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', 'artistprofiles', 'private', 'checkAccess');
    $rc = ciniki_artistprofiles_checkAccess($ciniki, $args['business_id'], 'ciniki.artistprofiles.linkUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Check for link type
    //
    if (isset($args['url'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'linkType');
        $rc = ciniki_artistprofiles_linkType($ciniki, $args['business_id'], $args['url']);
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        $args['link_type'] = $rc['link_type'];
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the Link in the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate');
    $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.artistprofiles.link', $args['link_id'], $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
        return $rc;
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.artistprofiles');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'artistprofiles');
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:artistprofiles,代码行数:66,代码来源:linkUpdate.php

示例11: ciniki_conferences_presentationUpdate

function ciniki_conferences_presentationUpdate(&$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'), 'conference_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Conference'), 'customer_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Customer'), 'presentation_type' => array('required' => 'no', 'blank' => 'no', 'name' => 'Type'), 'status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Status'), 'session_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Session'), 'registration' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Registration'), 'submission_date' => array('required' => 'no', 'blank' => 'no', 'type' => 'datetimetoutc', 'name' => 'Submission Date'), 'field' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Field of Study'), 'title' => array('required' => 'no', 'blank' => 'no', 'name' => 'Title'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description')));
    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.presentationUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Check if item exists
    //
    $strsql = "SELECT id, customer_id, conference_id " . "FROM ciniki_conferences_presentations " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . "";
    $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'item');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if (!isset($rc['item'])) {
        return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3093', 'msg' => 'Presentation does not exist'));
    }
    $item = $rc['item'];
    //
    // Check permalink if title is updated
    //
    if (isset($args['title'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
        $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['title']);
        //
        // Make sure the permalink is unique
        //
        $strsql = "SELECT id, title, permalink " . "FROM ciniki_conferences_presentations " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND conference_id = '" . ciniki_core_dbQuote($ciniki, isset($args['conference_id']) ? $args['conference_id'] : $item['conference_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . "";
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'presentation');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if ($rc['num_rows'] > 0) {
            return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3077', 'msg' => 'You already have a presentation with this title, please choose another title.'));
        }
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the Presentation in the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate');
    $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.presentation', $args['presentation_id'], $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    //
    // Check if registration set
    //
    if (isset($args['registration']) && $args['registration'] != '') {
        //
        // Check if customer already exists in attendees
        //
        $strsql = "SELECT id, conference_id, customer_id, status " . "FROM ciniki_conferences_attendees " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND conference_id = '" . ciniki_core_dbQuote($ciniki, $item['conference_id']) . "' " . "AND customer_id = '" . ciniki_core_dbQuote($ciniki, isset($args['customer_id']) ? $args['customer_id'] : $item['customer_id']) . "' " . "";
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'item');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        $attendee = $rc['item'];
        if (!isset($rc['item'])) {
            //
            // Add the attendee
            //
            ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
            $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.conferences.attendee', array('conference_id' => $item['conference_id'], 'customer_id' => isset($args['customer_id']) ? $args['customer_id'] : $item['customer_id'], 'status' => $args['registration']), 0x4);
            if ($rc['stat'] != 'ok') {
                ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
                return $rc;
            }
            $attendee_id = $rc['id'];
        } elseif ($attendee['status'] != $args['registration']) {
            //
            // Update the attendee
            //
            $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.conferences.attendee', $attendee['id'], array('status' => $args['registration']), 0x4);
            if ($rc['stat'] != 'ok') {
//.........这里部分代码省略.........
开发者ID:ciniki,项目名称:conferences,代码行数:101,代码来源:presentationUpdate.php

示例12: ciniki_library_itemDelete

function ciniki_library_itemDelete(&$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'), 'item_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Item')));
    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', 'library', 'private', 'checkAccess');
    $rc = ciniki_library_checkAccess($ciniki, $args['business_id'], 'ciniki.library.itemDelete');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $modules = $rc['modules'];
    //
    // Get the uuid of the item to be deleted
    //
    $strsql = "SELECT uuid FROM ciniki_library_items " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['item_id']) . "' " . "";
    $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.library', 'item');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if (!isset($rc['item'])) {
        return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.5', 'msg' => 'Unable to find existing item'));
    }
    $uuid = $rc['item']['uuid'];
    //
    // Turn off autocommit
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDelete');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbObjectDelete');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.library');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Remove the item
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectDelete');
    $rc = ciniki_core_objectDelete($ciniki, $args['business_id'], 'ciniki.library.item', $args['item_id'], $uuid);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.library');
        return $rc;
    }
    //
    // Commit the database changes
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.library');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'library');
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:library,代码行数:70,代码来源:itemDelete.php

示例13: ciniki_merchandise_imageUpdate

function ciniki_merchandise_imageUpdate(&$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'), 'productimage_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Image'), 'product_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Product'), 'name' => array('required' => 'no', 'blank' => 'no', 'name' => 'Name'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'sequence' => array('required' => 'no', 'blank' => 'no', 'name' => 'Sequence'), 'flags' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Options'), 'image_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Image'), 'description' => array('required' => 'no', 'blank' => 'no', 'name' => 'Description')));
    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', 'merchandise', 'private', 'checkAccess');
    $rc = ciniki_merchandise_checkAccess($ciniki, $args['business_id'], 'ciniki.merchandise.imageUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if (isset($args['name'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
        $args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']);
        //
        // Make sure the permalink is unique
        //
        $strsql = "SELECT id, name, permalink " . "FROM ciniki_merchandise_images " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['productimage_id']) . "' " . "";
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if ($rc['num_rows'] > 0) {
            return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.9', 'msg' => 'You already have an image with this name, please choose another.'));
        }
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.merchandise');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the Image in the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate');
    $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.merchandise.image', $args['productimage_id'], $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise');
        return $rc;
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.merchandise');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'merchandise');
    //
    // Update the web index if enabled
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'hookExec');
    ciniki_core_hookExec($ciniki, $args['business_id'], 'ciniki', 'web', 'indexObject', array('object' => 'ciniki.merchandise.image', 'object_id' => $args['productimage_id']));
    return array('stat' => 'ok');
}
开发者ID:ciniki,项目名称:merchandise,代码行数:75,代码来源:imageUpdate.php

示例14: ciniki_conferences_CFPLogAdd

function ciniki_conferences_CFPLogAdd(&$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'), 'name' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Name'), 'url' => array('required' => 'no', 'blank' => 'yes', 'name' => 'URL'), 'email' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Email'), 'sent_date' => array('required' => 'no', 'blank' => 'yes', 'type' => 'date', 'name' => 'Date'), 'notes' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Notes'), 'categories' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Categories')));
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    $args = $rc['args'];
    //
    // Check access to business_id as owner
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
    $rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.CFPLogAdd');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Add the cfp log to the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
    $rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.conferences.cfplog', $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
        return $rc;
    }
    $cfplog_id = $rc['id'];
    //
    // Update the categories
    //
    if (isset($args['categories'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate');
        $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.conferences', 'cfplogtag', $args['business_id'], 'ciniki_conferences_cfplog_tags', 'ciniki_conferences_history', 'cfplog_id', $cfplog_id, 10, $args['categories']);
        if ($rc['stat'] != 'ok') {
            ciniki_core_dbTransactionRollback($ciniki, 'ciniki.conferences');
            return $rc;
        }
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.conferences');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the last_change date in the business modules
    // Ignore the result, as we don't want to stop user updates if this fails.
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'updateModuleChangeDate');
    ciniki_businesses_updateModuleChangeDate($ciniki, $args['business_id'], 'ciniki', 'conferences');
    return array('stat' => 'ok', 'id' => $cfplog_id);
}
开发者ID:ciniki,项目名称:conferences,代码行数:66,代码来源:CFPLogAdd.php

示例15: ciniki_merchandise_productUpdate

function ciniki_merchandise_productUpdate(&$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'), 'product_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Merchandise Product'), 'code' => array('required' => 'no', 'blank' => 'yes', 'trimblanks' => 'yes', 'name' => 'Product Code'), 'name' => array('required' => 'no', 'blank' => 'no', 'trimblanks' => 'yes', 'name' => 'Product Name'), 'permalink' => array('required' => 'no', 'blank' => 'no', 'name' => 'Permalink'), 'status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Status'), 'sequence' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Sequence'), 'flags' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Options'), 'unit_amount' => array('required' => 'no', 'blank' => 'no', 'type' => 'currency', 'name' => 'Price'), 'unit_discount_amount' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Discount Amount'), 'unit_discount_percentage' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Discount Percentage'), 'taxtype_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Tax Type'), 'inventory' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Inventory'), 'shipping_other' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Shipping Cost Other'), 'shipping_CA' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Shipping Canada'), 'shipping_US' => array('required' => 'no', 'blank' => 'yes', 'type' => 'currency', 'name' => 'Shipping USA'), 'primary_image_id' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Image'), 'synopsis' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Synopsis'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description'), 'categories' => array('required' => 'no', 'blank' => 'yes', 'type' => 'list', 'delimiter' => '::', 'name' => 'Categories')));
    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', 'merchandise', 'private', 'checkAccess');
    $rc = ciniki_merchandise_checkAccess($ciniki, $args['business_id'], 'ciniki.merchandise.productUpdate');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Check if product already exists
    //
    $strsql = "SELECT id, code, name " . "FROM ciniki_merchandise " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "";
    $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'product');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    if (!isset($rc['product'])) {
        return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.20', 'msg' => 'That product does not exist.'));
    }
    $product = $rc['product'];
    //
    // Check to make sure code is unique
    //
    if (isset($args['code'])) {
        $strsql = "SELECT id, code, permalink " . "FROM ciniki_merchandise " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND code = '" . ciniki_core_dbQuote($ciniki, $args['code']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "";
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if ($rc['num_rows'] > 0) {
            return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.21', 'msg' => 'You already have a product with that code, please choose another.'));
        }
    }
    if (isset($args['name']) || isset($args['code'])) {
        if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x1)) {
            ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
            $args['permalink'] = ciniki_core_makePermalink($ciniki, (isset($args['code']) ? $args['code'] : $product['code']) . '-' . isset($args['name']) ? $args['name'] : $product['name']);
        } else {
            ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
            $args['permalink'] = ciniki_core_makePermalink($ciniki, isset($args['name']) ? $args['name'] : $product['name']);
        }
        //
        // Make sure the permalink is unique
        //
        $strsql = "SELECT id, code, name, permalink " . "FROM ciniki_merchandise " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "AND id <> '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "";
        $rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item');
        if ($rc['stat'] != 'ok') {
            return $rc;
        }
        if ($rc['num_rows'] > 0) {
            return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.22', 'msg' => 'You already have an merchandise product with this name, please choose another.'));
        }
    }
    //
    // Start transaction
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionStart');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionRollback');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbTransactionCommit');
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbAddModuleHistory');
    $rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.merchandise');
    if ($rc['stat'] != 'ok') {
        return $rc;
    }
    //
    // Update the Merchandise Product in the database
    //
    ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectUpdate');
    $rc = ciniki_core_objectUpdate($ciniki, $args['business_id'], 'ciniki.merchandise.product', $args['product_id'], $args, 0x4);
    if ($rc['stat'] != 'ok') {
        ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise');
        return $rc;
    }
    //
    // Update the categories
    //
    if (isset($args['categories'])) {
        ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'tagsUpdate');
        $rc = ciniki_core_tagsUpdate($ciniki, 'ciniki.merchandise', 'tag', $args['business_id'], 'ciniki_merchandise_tags', 'ciniki_merchandise_history', 'product_id', $args['product_id'], 10, $args['categories']);
        if ($rc['stat'] != 'ok') {
            ciniki_core_dbTransactionRollback($ciniki, 'ciniki.merchandise');
            return $rc;
        }
    }
    //
    // Commit the transaction
    //
    $rc = ciniki_core_dbTransactionCommit($ciniki, 'ciniki.merchandise');
//.........这里部分代码省略.........
开发者ID:ciniki,项目名称:merchandise,代码行数:101,代码来源:productUpdate.php


注:本文中的ciniki_core_dbTransactionRollback函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。