本文整理汇总了PHP中ciniki_core_dbHashQuery函数的典型用法代码示例。如果您正苦于以下问题:PHP ciniki_core_dbHashQuery函数的具体用法?PHP ciniki_core_dbHashQuery怎么用?PHP ciniki_core_dbHashQuery使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ciniki_core_dbHashQuery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ciniki_conferences_presentationHistory
function ciniki_conferences_presentationHistory($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'), 'field' => array('required' => 'yes', 'blank' => 'no', 'name' => 'field')));
if ($rc['stat'] != 'ok') {
return $rc;
}
$args = $rc['args'];
//
// Check access to business_id as owner, or sys admin
//
ciniki_core_loadMethod($ciniki, 'ciniki', 'conferences', 'private', 'checkAccess');
$rc = ciniki_conferences_checkAccess($ciniki, $args['business_id'], 'ciniki.conferences.presentationHistory');
if ($rc['stat'] != 'ok') {
return $rc;
}
if ($args['field'] == 'registration') {
$strsql = "SELECT ciniki_conferences_attendees.id " . "FROM ciniki_conferences_presentations, ciniki_conferences_attendees " . "WHERE ciniki_conferences_presentations.id = '" . ciniki_core_dbQuote($ciniki, $args['presentation_id']) . "' " . "AND ciniki_conferences_presentations.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_presentations.customer_id = ciniki_conferences_attendees.customer_id " . "AND ciniki_conferences_presentations.conference_id = ciniki_conferences_attendees.conference_id " . "AND ciniki_conferences_attendees.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'attendee');
if ($rc['stat'] != 'ok') {
return $rc;
}
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbGetModuleHistory');
return ciniki_core_dbGetModuleHistory($ciniki, 'ciniki.conferences', 'ciniki_conferences_history', $args['business_id'], 'ciniki_conferences_attendees', $rc['attendee']['id'], 'status');
}
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbGetModuleHistory');
return ciniki_core_dbGetModuleHistory($ciniki, 'ciniki.conferences', 'ciniki_conferences_history', $args['business_id'], 'ciniki_conferences_presentations', $args['presentation_id'], $args['field']);
}
示例2: ciniki_artistprofiles_web_subMenuItems
function ciniki_artistprofiles_web_subMenuItems(&$ciniki, $settings, $business_id, $args)
{
if (!isset($ciniki['business']['modules']['ciniki.artistprofiles'])) {
return array('stat' => '404', 'err' => array('pkg' => 'ciniki', 'code' => '3040', 'msg' => "I'm sorry, the file you requested does not exist."));
}
//
// Return nothing if the page format doesn't have a submenu
//
if (isset($settings['page-artistprofiles-submenu']) && $settings['page-artistprofiles-submenu'] != 'yes') {
return array('stat' => 'ok', 'submenu' => array());
}
$submenu = array();
//
// Check if Categories is enabled
//
if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.artistprofiles', 0x100)) {
//
// Load the settings for categories
//
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbDetailsQueryDash');
$rc = ciniki_core_dbDetailsQueryDash($ciniki, 'ciniki_artistprofiles_settings', 'business_id', $business_id, 'ciniki.artistprofiles', 'settings', 'tag-category');
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['settings'])) {
$psettings = $rc['settings'];
} else {
$psettings = array();
}
if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.artistprofiles', 0x200)) {
$submenu['featured'] = array('sequence' => 1, 'title' => 'Featured', 'sequence' => isset($psettings['tag-category-sequence-featured']) && $psettings['tag-category-sequence-featured'] != '' ? $psettings['tag-category-sequence-featured'] : 1, 'title' => isset($psettings['tag-category-title-featured']) && $psettings['tag-category-title-featured'] != '' ? $psettings['tag-category-title-featured'] : 'Featured', 'image_id' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-image-featured']) ? $psettings['tag-category-image-featured'] : '', 'content' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-content-featured']) ? $psettings['tag-category-content-featured'] : '', 'permalink' => 'featured');
}
//
// Load the list of tags
//
$strsql = "SELECT DISTINCT tag_name, permalink " . "FROM ciniki_artistprofiles_tags " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND tag_type = 10 " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'category');
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['rows'])) {
$categories = $rc['rows'];
foreach ($categories as $cat) {
$submenu[$cat['permalink']] = array('sequence' => isset($psettings['tag-category-sequence-' . $cat['permalink']]) && $psettings['tag-category-sequence-' . $cat['permalink']] != '' ? $psettings['tag-category-sequence-' . $cat['permalink']] : 10, 'title' => isset($psettings['tag-category-title-' . $cat['permalink']]) && $psettings['tag-category-title-' . $cat['permalink']] != '' ? $psettings['tag-category-title-' . $cat['permalink']] : $cat['tag_name'], 'image_id' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-image-' . $cat['permalink']]) ? $psettings['tag-category-image-' . $cat['permalink']] : '', 'content' => isset($args['content']) && $args['content'] == 'yes' && isset($psettings['tag-category-content-' . $cat['permalink']]) ? $psettings['tag-category-content-' . $cat['permalink']] : '', 'permalink' => $cat['permalink']);
}
}
//
// Sort the submenu
//
uasort($submenu, function ($a, $b) {
if ($a['sequence'] == $b['sequence']) {
return strcmp($b['title'], $a['title']);
}
return $a['sequence'] < $b['sequence'] ? -1 : 1;
});
}
return array('stat' => 'ok', 'submenu' => $submenu);
}
示例3: ciniki_conferences_roomGet
function ciniki_conferences_roomGet($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')));
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.roomGet');
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 Conference Room
//
if ($args['room_id'] == 0) {
$room = array('id' => 0, 'conference_id' => '', 'name' => '', 'sequence' => '1');
} else {
$strsql = "SELECT ciniki_conferences_rooms.id, " . "ciniki_conferences_rooms.conference_id, " . "ciniki_conferences_rooms.name, " . "ciniki_conferences_rooms.sequence " . "FROM ciniki_conferences_rooms " . "WHERE ciniki_conferences_rooms.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_rooms.id = '" . ciniki_core_dbQuote($ciniki, $args['room_id']) . "' " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'room');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3593', 'msg' => 'Conference Room not found', 'err' => $rc['err']));
}
if (!isset($rc['room'])) {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3594', 'msg' => 'Unable to find Conference Room'));
}
$room = $rc['room'];
}
return array('stat' => 'ok', 'room' => $room);
}
示例4: ciniki_merchandise_imageGet
function ciniki_merchandise_imageGet($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')));
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.imageGet');
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 Image
//
if ($args['productimage_id'] == 0) {
$image = array('id' => 0, 'product_id' => '', 'name' => '', 'permalink' => '', 'sequence' => '', 'flags' => '1', 'image_id' => 0, 'description' => '');
} else {
$strsql = "SELECT ciniki_merchandise_images.id, " . "ciniki_merchandise_images.product_id, " . "ciniki_merchandise_images.name, " . "ciniki_merchandise_images.permalink, " . "ciniki_merchandise_images.sequence, " . "ciniki_merchandise_images.flags, " . "ciniki_merchandise_images.image_id, " . "ciniki_merchandise_images.description " . "FROM ciniki_merchandise_images " . "WHERE ciniki_merchandise_images.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_merchandise_images.id = '" . ciniki_core_dbQuote($ciniki, $args['productimage_id']) . "' " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'image');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.7', 'msg' => 'Image not found', 'err' => $rc['err']));
}
if (!isset($rc['image'])) {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.8', 'msg' => 'Unable to find Image'));
}
$image = $rc['image'];
}
return array('stat' => 'ok', 'image' => $image);
}
示例5: ciniki_artistprofiles_linkGet
function ciniki_artistprofiles_linkGet($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')));
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.linkGet');
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 Link
//
if ($args['link_id'] == 0) {
$link = array('id' => 0, 'artist_id' => '', 'name' => '', 'link_type' => '1000', 'url' => '', 'description' => '');
} else {
$strsql = "SELECT ciniki_artistprofiles_links.id, " . "ciniki_artistprofiles_links.artist_id, " . "ciniki_artistprofiles_links.name, " . "ciniki_artistprofiles_links.link_type, " . "ciniki_artistprofiles_links.url, " . "ciniki_artistprofiles_links.description " . "FROM ciniki_artistprofiles_links " . "WHERE ciniki_artistprofiles_links.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_artistprofiles_links.id = '" . ciniki_core_dbQuote($ciniki, $args['link_id']) . "' " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'link');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2910', 'msg' => 'Link not found', 'err' => $rc['err']));
}
if (!isset($rc['link'])) {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2911', 'msg' => 'Unable to find Link'));
}
$link = $rc['link'];
}
return array('stat' => 'ok', 'link' => $link);
}
示例6: ciniki_merchandise_web_productLoad
function ciniki_merchandise_web_productLoad($ciniki, $business_id, $args)
{
$strsql = "SELECT ciniki_merchandise.id, " . "ciniki_merchandise.uuid, " . "ciniki_merchandise.name, " . "ciniki_merchandise.permalink, " . "ciniki_merchandise.flags, " . "ciniki_merchandise.primary_image_id, " . "'' AS primary_image_caption, " . "ciniki_merchandise.synopsis, " . "ciniki_merchandise.description " . "FROM ciniki_merchandise " . "WHERE ciniki_merchandise.business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "";
if (isset($args['permalink']) && $args['permalink'] != '') {
$strsql .= "AND ciniki_merchandise.permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' ";
} elseif (isset($args['id']) && $args['id'] > 0) {
$strsql .= "AND ciniki_merchandise.id = '" . ciniki_core_dbQuote($ciniki, $args['id']) . "' ";
} else {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.27', 'msg' => 'No product specified'));
}
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'product');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.28', 'msg' => 'Product not found', 'err' => $rc['err']));
}
if (!isset($rc['product'])) {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.29', 'msg' => 'Unable to find Product'));
}
$product = $rc['product'];
//
// Get the images
//
if (isset($args['images']) && $args['images'] == 'yes') {
$strsql = "SELECT id, " . "name AS title, " . "permalink, " . "flags, " . "image_id, " . "description " . "FROM ciniki_merchandise_images " . "WHERE product_id = '" . ciniki_core_dbQuote($ciniki, $product['id']) . "' " . "AND business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
$rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.merchandise', array(array('container' => 'images', 'fname' => 'id', 'fields' => array('id', 'title', 'permalink', 'flags', 'image_id', 'description'))));
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['images'])) {
$product['images'] = $rc['images'];
} else {
$product['images'] = array();
}
if ($product['primary_image_id'] > 0) {
$found = 'no';
foreach ($product['images'] as $image) {
if ($image['image_id'] == $product['primary_image_id']) {
$found = 'yes';
}
}
if ($found == 'no') {
array_unshift($product['images'], array('title' => '', 'flags' => 1, 'permalink' => $product['uuid'], 'image_id' => $product['primary_image_id'], 'description' => ''));
}
}
}
return array('stat' => 'ok', 'product' => $product);
}
示例7: ciniki_library_checkAccess
function ciniki_library_checkAccess(&$ciniki, $business_id, $method)
{
//
// Check if the business is active and the module is enabled
//
ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'checkModuleAccess');
$rc = ciniki_businesses_checkModuleAccess($ciniki, $business_id, 'ciniki', 'library');
if ($rc['stat'] != 'ok') {
return $rc;
}
$modules = $rc['modules'];
if (!isset($rc['ruleset'])) {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.1', 'msg' => 'No permissions granted'));
}
//
// Sysadmins are allowed full access
//
if (($ciniki['session']['user']['perms'] & 0x1) == 0x1) {
return array('stat' => 'ok', 'modules' => $modules);
}
//
// Users who are an owner or employee of a business can see the business alerts
//
$strsql = "SELECT business_id, user_id FROM ciniki_business_users " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND user_id = '" . ciniki_core_dbQuote($ciniki, $ciniki['session']['user']['id']) . "' " . "AND package = 'ciniki' " . "AND status = 10 " . "AND (permission_group = 'owners' OR permission_group = 'employees' OR permission_group = 'resellers' ) " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.businesses', 'user');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.2', 'msg' => 'Access denied.'));
}
//
// If the user has permission, return ok
//
if (isset($rc['rows']) && isset($rc['rows'][0]) && $rc['rows'][0]['user_id'] > 0 && $rc['rows'][0]['user_id'] == $ciniki['session']['user']['id']) {
return array('stat' => 'ok', 'modules' => $modules);
}
//
// By default fail
//
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.library.3', 'msg' => 'Access denied'));
}
示例8: ciniki_artistprofiles_cron_jobs
function ciniki_artistprofiles_cron_jobs(&$ciniki)
{
ciniki_cron_logMsg($ciniki, 0, array('code' => '0', 'msg' => 'Checking for artistprofiles jobs', 'severity' => '5'));
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbQuote');
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
ciniki_core_loadMethod($ciniki, 'ciniki', 'businesses', 'private', 'checkModuleAccess');
ciniki_core_loadMethod($ciniki, 'ciniki', 'artistprofiles', 'private', 'dropboxDownload');
//
// Get the list of businesses that have artistprofiles enables and dropbox flag
//
$strsql = "SELECT business_id " . "FROM ciniki_business_modules " . "WHERE package = 'ciniki' " . "AND module = 'artistprofiles' " . "AND (flags&0x01) = 1 " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.sapos', 'item');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2880', 'msg' => 'Unable to get list of businesses with artist profiles', 'err' => $rc['err']));
}
if (!isset($rc['rows'])) {
return array('stat' => 'ok');
}
$businesses = $rc['rows'];
foreach ($businesses as $business) {
//
// Load business modules
//
$rc = ciniki_businesses_checkModuleAccess($ciniki, $business['business_id'], 'ciniki', 'artistprofiles');
if ($rc['stat'] != 'ok') {
ciniki_cron_logMsg($ciniki, $business['business_id'], array('code' => '2879', 'msg' => 'ciniki.artistprofiles not configured', 'severity' => 30, 'err' => $rc['err']));
continue;
}
ciniki_cron_logMsg($ciniki, $business['business_id'], array('code' => '0', 'msg' => 'Updating artistprofiles from dropbox', 'severity' => '10'));
//
// Update the business artistprofiles from dropbox
//
$rc = ciniki_artistprofiles_dropboxDownload($ciniki, $business['business_id']);
if ($rc['stat'] != 'ok') {
ciniki_cron_logMsg($ciniki, $business['business_id'], array('code' => '2878', 'msg' => 'Unable to update artistprofiles', 'severity' => 50, 'err' => $rc['err']));
continue;
}
}
return array('stat' => 'ok');
}
示例9: ciniki_artistprofiles_hooks_webIndexObject
function ciniki_artistprofiles_hooks_webIndexObject($ciniki, $business_id, $args)
{
if (!isset($args['object']) || $args['object'] == '') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3275', 'msg' => 'No object specified'));
}
if (!isset($args['object_id']) || $args['object_id'] == '') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3276', 'msg' => 'No object ID specified'));
}
//
// Setup the base_url for use in index
//
if (isset($args['base_url'])) {
$base_url = $args['base_url'];
} else {
$base_url = '/artists';
}
if ($args['object'] == 'ciniki.artistprofiles.artist') {
$strsql = "SELECT id, name, subname, sort_name, permalink, status, " . "primary_image_id, synopsis, description " . "FROM ciniki_artistprofiles " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $business_id) . "' " . "AND id = '" . ciniki_core_dbQuote($ciniki, $args['object_id']) . "' " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'item');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3280', 'msg' => 'Object not found'));
}
if (!isset($rc['item'])) {
return array('stat' => 'noexist', 'err' => array('pkg' => 'ciniki', 'code' => '3281', 'msg' => 'Object not found'));
}
//
// Check if item is visible on website
//
if ($rc['item']['status'] != '10') {
return array('stat' => 'ok');
}
$object = array('label' => 'Artists', 'title' => $rc['item']['name'], 'subtitle' => $rc['item']['subname'], 'meta' => '', 'primary_image_id' => $rc['item']['primary_image_id'], 'synopsis' => $rc['item']['synopsis'], 'object' => 'ciniki.artistprofiles.artist', 'object_id' => $rc['item']['id'], 'primary_words' => $rc['item']['name'], 'secondary_words' => $rc['item']['subname'] . ' ' . $rc['item']['synopsis'], 'tertiary_words' => $rc['item']['description'], 'weight' => 20000, 'url' => $base_url . '/' . $rc['item']['permalink']);
return array('stat' => 'ok', 'object' => $object);
}
return array('stat' => 'ok');
}
示例10: ciniki_merchandise_productGet
function ciniki_merchandise_productGet($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'), 'images' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Images')));
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.productGet');
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 Merchandise Product
//
if ($args['product_id'] == 0) {
$product = array('id' => 0, 'code' => '', 'name' => '', 'permalink' => '', 'status' => '10', 'sequence' => '1', 'flags' => '0', 'unit_amount' => '', 'unit_discount_amount' => '', 'unit_discount_percentage' => '', 'taxtype_id' => '0', 'inventory' => '', 'shipping_other' => '', 'shipping_CA' => '', 'shipping_US' => '', 'primary_image_id' => '0', 'synopsis' => '', 'description' => '', 'images' => array());
} else {
$strsql = "SELECT ciniki_merchandise.id, " . "ciniki_merchandise.code, " . "ciniki_merchandise.name, " . "ciniki_merchandise.permalink, " . "ciniki_merchandise.status, " . "ciniki_merchandise.sequence, " . "ciniki_merchandise.flags, " . "ciniki_merchandise.unit_amount, " . "ciniki_merchandise.unit_discount_amount, " . "ciniki_merchandise.unit_discount_percentage, " . "ciniki_merchandise.taxtype_id, " . "ciniki_merchandise.inventory, " . "ciniki_merchandise.shipping_other, " . "ciniki_merchandise.shipping_CA, " . "ciniki_merchandise.shipping_US, " . "ciniki_merchandise.primary_image_id, " . "ciniki_merchandise.synopsis, " . "ciniki_merchandise.description " . "FROM ciniki_merchandise " . "WHERE ciniki_merchandise.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_merchandise.id = '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'product');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.17', 'msg' => 'Merchandise Product not found', 'err' => $rc['err']));
}
if (!isset($rc['product'])) {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.18', 'msg' => 'Unable to find Merchandise Product'));
}
$product = $rc['product'];
$product['unit_amount'] = $product['unit_amount'] == 0 ? '' : numfmt_format_currency($intl_currency_fmt, $product['unit_amount'], $intl_currency);
$product['unit_discount_amount'] = $product['unit_discount_amount'] == 0 ? '' : numfmt_format_currency($intl_currency_fmt, $product['unit_discount_amount'], $intl_currency);
$product['shipping_other'] = $product['shipping_other'] == 0 ? '' : numfmt_format_currency($intl_currency_fmt, $product['shipping_other'], $intl_currency);
$product['shipping_CA'] = $product['shipping_CA'] == 0 ? '' : numfmt_format_currency($intl_currency_fmt, $product['shipping_CA'], $intl_currency);
$product['shipping_US'] = $product['shipping_US'] == 0 ? '' : numfmt_format_currency($intl_currency_fmt, $product['shipping_US'], $intl_currency);
//
// Get any tags for this product
//
if (ciniki_core_checkModuleFlags($ciniki, 'ciniki.merchandise', 0x4)) {
$product['categories'] = array();
$strsql = "SELECT tag_type, tag_name AS lists " . "FROM ciniki_merchandise_tags " . "WHERE product_id = '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "AND business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "ORDER BY tag_type, tag_name " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryTree');
$rc = ciniki_core_dbHashQueryTree($ciniki, $strsql, 'ciniki.merchandise', array(array('container' => 'tags', 'fname' => 'tag_type', 'name' => 'tags', 'fields' => array('tag_type', 'lists'), 'dlists' => array('lists' => '::'))));
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['tags'])) {
foreach ($rc['tags'] as $tags) {
if ($tags['tags']['tag_type'] == 10) {
$product['categories'] = $tags['tags']['lists'];
}
}
}
}
//
// Get the list of object references for this product
//
$strsql = "SELECT id, object, object_id, 'Unknown' as display_name " . "FROM ciniki_merchandise_objrefs " . "WHERE product_id = '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
$rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.merchandise', array(array('container' => 'objrefs', 'fname' => 'id', 'fields' => array('id', 'object', 'object_id', 'display_name'))));
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['objrefs'])) {
$product['objrefs'] = $rc['objrefs'];
foreach ($product['objrefs'] as $rid => $ref) {
list($pkg, $mod, $obj) = explode('.', $ref['object']);
$rc = ciniki_core_loadMethod($ciniki, $pkg, $mod, 'hooks', 'getObjectName');
if ($rc['stat'] == 'ok') {
$fn = $rc['function_call'];
$rc = $fn($ciniki, $args['business_id'], array('object' => $ref['object'], 'object_id' => $ref['object_id']));
if ($rc['stat'] == 'ok' && isset($rc['name'])) {
$product['objrefs'][$rid]['display_name'] = $rc['name'];
}
}
}
} else {
$product['objrefs'] = array();
}
//
// Get the additional images for this product
//.........这里部分代码省略.........
示例11: ciniki_conferences_conferenceGet
function ciniki_conferences_conferenceGet($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'), 'cfplogs' => array('required' => 'no', 'blank' => 'yes', 'name' => 'CFP Log Entries'), 'presentations' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Presentations'), 'presentation_status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Presentations'), 'registration_status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Registrations'), 'presentation_type' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Presentations'), 'reviewers' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Reviewers'), 'attendees' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Attendees'), 'attendee_status' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Presentations'), 'rooms' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Rooms'), 'sessions' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Session'), 'sessionpresentations' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Assigned Presentations'), 'stats' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Stats')));
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.conferenceGet');
if ($rc['stat'] != 'ok') {
return $rc;
}
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryIDTree');
//
// 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', 'dateFormat');
ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'timeFormat');
$date_format = ciniki_users_dateFormat($ciniki, 'php');
$time_format = ciniki_users_timeFormat($ciniki, 'php');
$mysql_date_format = ciniki_users_dateFormat($ciniki, 'mysql');
//
// 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 Conference
//
$email_list = '';
if ($args['conference_id'] == 0) {
$conference = array('id' => 0, 'name' => '', 'permalink' => '', 'status' => '10', 'flags' => '0', 'start_date' => '', 'end_date' => '', 'synopsis' => '', 'description' => '');
} else {
$strsql = "SELECT ciniki_conferences.id, " . "ciniki_conferences.name, " . "ciniki_conferences.permalink, " . "ciniki_conferences.status, " . "ciniki_conferences.status AS status_text, " . "ciniki_conferences.flags, " . "DATE_FORMAT(ciniki_conferences.start_date, '" . ciniki_core_dbQuote($ciniki, $mysql_date_format) . "') AS start_date, " . "DATE_FORMAT(ciniki_conferences.end_date, '" . ciniki_core_dbQuote($ciniki, $mysql_date_format) . "') AS end_date, " . "ciniki_conferences.synopsis, " . "ciniki_conferences.description, " . "ciniki_conferences.imap_mailbox, " . "ciniki_conferences.imap_username, " . "ciniki_conferences.imap_password, " . "ciniki_conferences.imap_subject " . "FROM ciniki_conferences " . "WHERE ciniki_conferences.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences.id = '" . ciniki_core_dbQuote($ciniki, $args['conference_id']) . "' " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'conference');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2840', 'msg' => 'Conference not found', 'err' => $rc['err']));
}
if (!isset($rc['conference'])) {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2841', 'msg' => 'Unable to find Conference'));
}
$conference = $rc['conference'];
if (isset($maps['conference']['status'][$conference['status_text']])) {
$conference['status_text'] = $maps['conference']['status'][$conference['status_text']];
}
//
// Check if CFP logs should be returned
//
if (isset($args['cfplogs']) && $args['cfplogs'] == 'yes') {
$strsql = "SELECT ciniki_conferences_cfplogs.id, " . "ciniki_conferences_cfplogs.name, " . "ciniki_conferences_cfplogs.url, " . "ciniki_conferences_cfplogs.sent_date, " . "ciniki_conferences_cfplogs.email " . "FROM ciniki_conferences_cfplogs " . "WHERE ciniki_conferences_cfplogs.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_cfplogs.conference_id = '" . ciniki_core_dbQuote($ciniki, $args['conference_id']) . "' " . "";
$rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'cfplogs', 'fname' => 'id', 'fields' => array('id', 'name', 'url', 'email', 'sent_date'), 'utctotz' => array('sent_date' => array('format' => $date_format, 'timezone' => 'UTC')))));
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['cfplogs'])) {
$conference['cfplogs'] = $rc['cfplogs'];
} else {
$conference['cfplogs'] = array();
}
}
//
// Check if presentations should be returned
//
if (isset($args['presentations']) && $args['presentations'] == 'yes') {
$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, " . "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, " . "IF(ciniki_conferences_presentation_reviews.vote > 0, 'yes', 'no') AS voted, " . "COUNT(ciniki_conferences_presentation_reviews.id) AS num_votes " . "FROM ciniki_conferences_presentations " . "LEFT JOIN ciniki_conferences_attendees ON (" . "ciniki_conferences_presentations.customer_id = ciniki_conferences_attendees.customer_id " . "AND ciniki_conferences_presentations.conference_id = ciniki_conferences_attendees.conference_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']) . "' " . ") " . "LEFT JOIN ciniki_conferences_presentation_reviews ON (" . "ciniki_conferences_presentations.id = ciniki_conferences_presentation_reviews.presentation_id " . "AND ciniki_conferences_presentation_reviews.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "WHERE ciniki_conferences_presentations.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "";
if (isset($args['presentation_status']) && $args['presentation_status'] > 0) {
$strsql .= "AND ciniki_conferences_presentations.status = '" . ciniki_core_dbQuote($ciniki, $args['presentation_status']) . "' ";
}
if (isset($args['presentation_type']) && $args['presentation_type'] > 0) {
$strsql .= "AND ciniki_conferences_presentations.presentation_type = '" . ciniki_core_dbQuote($ciniki, $args['presentation_type']) . "' ";
}
$strsql .= "GROUP BY ciniki_conferences_presentations.id, voted ";
if (isset($args['registration_status']) && $args['registration_status'] != '') {
$strsql .= "HAVING registration = '" . ciniki_core_dbQuote($ciniki, $args['registration_status']) . "' ";
}
$strsql .= "ORDER BY submission_date ";
$rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'presentations', 'fname' => 'id', 'fields' => array('id', 'conference_id', 'customer_id', 'presentation_type', 'presentation_number', 'status', 'status_text', 'registration', 'registration_text', 'submission_date', 'field', 'title', 'display_name', 'permalink'), 'utctotz' => array('submission_date' => array('format' => 'M j', 'timezone' => $intl_timezone)), 'maps' => array('status_text' => $maps['presentation']['status'], 'registration_text' => $maps['attendee']['status'], 'presentation_type_text' => $maps['presentation']['presentation_type'])), array('container' => 'voted', 'fname' => 'voted', 'fields' => array('voted', 'num_votes'))));
if ($rc['stat'] != 'ok') {
//.........这里部分代码省略.........
示例12: ciniki_merchandise_productAddObjRef
function ciniki_merchandise_productAddObjRef(&$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' => 'Product'), 'object' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Object'), 'object_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Object ID')));
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.productAddObjRef');
if ($rc['stat'] != 'ok') {
return $rc;
}
//
// Check to make sure the product exists
//
$strsql = "SELECT id, code, permalink " . "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', 'item');
if ($rc['stat'] != 'ok') {
return $rc;
}
if (!isset($rc['item'])) {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.14', 'msg' => 'Unable to find product.'));
}
//
// Check to make sure the object ref does not already exist
//
$strsql = "SELECT id " . "FROM ciniki_merchandise_objrefs " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND product_id = '" . ciniki_core_dbQuote($ciniki, $args['product_id']) . "' " . "AND object = '" . ciniki_core_dbQuote($ciniki, $args['object']) . "' " . "AND object_id = '" . ciniki_core_dbQuote($ciniki, $args['object_id']) . "' " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.merchandise', 'item');
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['item'])) {
return array('stat' => 'fail', 'err' => array('code' => 'ciniki.merchandise.15', 'msg' => 'This product already exists.'));
}
//
// 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');
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
$rc = ciniki_core_dbTransactionStart($ciniki, 'ciniki.merchandise');
if ($rc['stat'] != 'ok') {
return $rc;
}
//
// If the object is specified
//
$rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.merchandise.objref', array('product_id' => $args['product_id'], 'object' => $args['object'], 'object_id' => $args['object_id'], 'sequence' => 1), 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');
}
示例13: ciniki_artistprofiles_imageAdd
function ciniki_artistprofiles_imageAdd(&$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'), 'artist_id' => array('required' => 'yes', 'blank' => 'no', 'name' => 'Artist'), 'name' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Name'), 'flags' => array('required' => 'no', 'blank' => 'no', 'name' => 'Options'), 'image_id' => array('required' => 'no', 'blank' => 'no', 'name' => 'Image'), 'description' => array('required' => 'no', 'blank' => 'yes', 'name' => 'Description')));
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.imageAdd');
if ($rc['stat'] != 'ok') {
return $rc;
}
//
// Get a UUID for use in permalink
//
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbUUID');
$rc = ciniki_core_dbUUID($ciniki, 'ciniki.artistprofiles');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2890', 'msg' => 'Unable to get a new UUID', 'err' => $rc['err']));
}
$args['uuid'] = $rc['uuid'];
//
// Determine the permalink
//
if (!isset($args['permalink']) || $args['permalink'] == '') {
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'makePermalink');
if (isset($args['name']) && $args['name'] != '') {
$args['permalink'] = ciniki_core_makePermalink($ciniki, $args['name']);
} else {
$args['permalink'] = ciniki_core_makePermalink($ciniki, $args['uuid']);
}
}
//
// Check the permalink doesn't already exist
//
$strsql = "SELECT id, name, permalink " . "FROM ciniki_artistprofiles_images " . "WHERE business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND artist_id = '" . ciniki_core_dbQuote($ciniki, $args['artist_id']) . "' " . "AND permalink = '" . ciniki_core_dbQuote($ciniki, $args['permalink']) . "' " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.artistprofiles', 'image');
if ($rc['stat'] != 'ok') {
return $rc;
}
if ($rc['num_rows'] > 0) {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '2892', 'msg' => 'You already have an image 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 image to the database
//
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'objectAdd');
$rc = ciniki_core_objectAdd($ciniki, $args['business_id'], 'ciniki.artistprofiles.image', $args, 0x4);
if ($rc['stat'] != 'ok') {
ciniki_core_dbTransactionRollback($ciniki, 'ciniki.artistprofiles');
return $rc;
}
$artist_image_id = $rc['id'];
//
// 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' => $artist_image_id);
}
示例14: 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');
}
示例15: ciniki_conferences_conferenceScheduleDownload
function ciniki_conferences_conferenceScheduleDownload($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')));
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.conferenceScheduleDownload');
if ($rc['stat'] != 'ok') {
return $rc;
}
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQuery');
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryIDTree');
//
// 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', 'dateFormat');
ciniki_core_loadMethod($ciniki, 'ciniki', 'users', 'private', 'timeFormat');
$date_format = ciniki_users_dateFormat($ciniki, 'php');
$time_format = ciniki_users_timeFormat($ciniki, 'php');
$mysql_date_format = ciniki_users_dateFormat($ciniki, 'mysql');
//
// 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'];
$strsql = "SELECT ciniki_conferences.id, " . "ciniki_conferences.name, " . "ciniki_conferences.permalink, " . "ciniki_conferences.status, " . "ciniki_conferences.status AS status_text, " . "ciniki_conferences.flags, " . "DATE_FORMAT(ciniki_conferences.start_date, '" . ciniki_core_dbQuote($ciniki, $mysql_date_format) . "') AS start_date, " . "DATE_FORMAT(ciniki_conferences.end_date, '" . ciniki_core_dbQuote($ciniki, $mysql_date_format) . "') AS end_date, " . "ciniki_conferences.synopsis, " . "ciniki_conferences.description, " . "ciniki_conferences.imap_mailbox, " . "ciniki_conferences.imap_username, " . "ciniki_conferences.imap_password, " . "ciniki_conferences.imap_subject " . "FROM ciniki_conferences " . "WHERE ciniki_conferences.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences.id = '" . ciniki_core_dbQuote($ciniki, $args['conference_id']) . "' " . "";
$rc = ciniki_core_dbHashQuery($ciniki, $strsql, 'ciniki.conferences', 'conference');
if ($rc['stat'] != 'ok') {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3631', 'msg' => 'Conference not found', 'err' => $rc['err']));
}
if (!isset($rc['conference'])) {
return array('stat' => 'fail', 'err' => array('pkg' => 'ciniki', 'code' => '3632', 'msg' => 'Unable to find Conference'));
}
$conference = $rc['conference'];
if (isset($maps['conference']['status'][$conference['status_text']])) {
$conference['status_text'] = $maps['conference']['status'][$conference['status_text']];
}
$strsql = "SELECT ciniki_conferences_sessions.id, " . "CONCAT_WS('-', ciniki_conferences_sessions.id, ciniki_conferences_presentations.id) AS rowid, " . "ciniki_conferences_sessions.conference_id, " . "ciniki_conferences_sessions.room_id, " . "ciniki_conferences_rooms.name AS room, " . "ciniki_conferences_rooms.sequence, " . "ciniki_conferences_sessions.name, " . "ciniki_conferences_sessions.session_start AS start_time, " . "ciniki_conferences_sessions.session_start AS start_date, " . "ciniki_conferences_sessions.session_end AS end_time, " . "IFNULL(ciniki_conferences_presentations.id, 0) AS presentation_id, " . "IFNULL(ciniki_conferences_presentations.customer_id, 0) AS customer_id, " . "IFNULL(ciniki_conferences_presentations.presentation_number, '') AS presentation_number, " . "IFNULL(ciniki_conferences_presentations.title, '') AS presentation_title, " . "IFNULL(ciniki_conferences_presentations.description, '') AS presentation_description, " . "IFNULL(ciniki_customers.display_name, '') AS display_name, " . "IFNULL(ciniki_conferences_presentations.status, 0) AS status, " . "IFNULL(ciniki_conferences_presentations.status, '') AS status_text, " . "IFNULL(ciniki_conferences_attendees.status, 0) AS registration, " . "IFNULL(ciniki_conferences_attendees.status, 0) AS registration_text " . "FROM ciniki_conferences_sessions " . "INNER 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']) . "' " . ") " . "LEFT JOIN ciniki_conferences_presentations ON (" . "ciniki_conferences_sessions.id = ciniki_conferences_presentations.session_id " . "AND ciniki_conferences_presentations.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . ") " . "LEFT JOIN ciniki_conferences_attendees ON (" . "ciniki_conferences_presentations.customer_id = ciniki_conferences_attendees.customer_id " . "AND ciniki_conferences_presentations.conference_id = ciniki_conferences_attendees.conference_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_sessions.business_id = '" . ciniki_core_dbQuote($ciniki, $args['business_id']) . "' " . "AND ciniki_conferences_sessions.conference_id = '" . ciniki_core_dbQuote($ciniki, $args['conference_id']) . "' " . "ORDER BY ciniki_conferences_sessions.session_start, " . "ciniki_conferences_rooms.name, " . "ciniki_conferences_rooms.sequence, " . "ciniki_conferences_presentations.title " . "";
ciniki_core_loadMethod($ciniki, 'ciniki', 'core', 'private', 'dbHashQueryArrayTree');
$rc = ciniki_core_dbHashQueryArrayTree($ciniki, $strsql, 'ciniki.conferences', array(array('container' => 'times', 'fname' => 'start_time', 'fields' => array('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))), array('container' => 'rooms', 'fname' => 'room_id', 'fields' => array('id' => 'room_id', 'name' => 'room', 'session_name' => 'name', 'presentation_id')), array('container' => 'presentations', 'fname' => 'presentation_id', 'fields' => array('id', 'conference_id', 'room_id', 'room', 'sequence', 'name', 'start_time', 'start_date', 'end_time', 'presentation_id', 'customer_id', 'presentation_number', 'presentation_title', 'presentation_description', 'display_name', 'status', 'status_text', 'registration', 'registration_text'), '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)), 'maps' => array('status_text' => $maps['presentation']['status'], 'registration_text' => $maps['attendee']['status']))));
if ($rc['stat'] != 'ok') {
return $rc;
}
if (isset($rc['times'])) {
$timeslots = $rc['times'];
} else {
$timeslots = array();
}
//
// Generate the word file
//
require_once $ciniki['config']['core']['lib_dir'] . '/PHPWord/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
require $ciniki['config']['core']['lib_dir'] . '/PHPWord/src/PhpWord/PhpWord.php';
$PHPWord = new \PhpOffice\PhpWord\PhpWord();
$PHPWord->addTitleStyle(1, array('bold' => true, 'size' => 18), array('spaceBefore' => 240, 'spaceAfter' => 120));
$PHPWord->addTitleStyle(2, array('bold' => true, 'size' => 16), array('spaceBefore' => 120, 'spaceAfter' => 120));
$PHPWord->addTitleStyle(3, array('bold' => false, 'size' => 14), array('spaceBefore' => 120, 'spaceAfter' => 120));
$style_table = array('cellMargin' => 80, 'borderColor' => 'aaaaaa', 'borderSize' => 6);
$style_header = array('borderSize' => 6, 'borderColor' => 'aaaaaa', 'bgColor' => 'dddddd', 'valign' => 'center');
$style_cell = array('borderSize' => 6, 'borderColor' => 'aaaaaa', 'valign' => 'center', 'bgcolor' => 'ffffff');
$style_header_font = array('bold' => true, 'spaceAfter' => 20);
$style_cell_font = array();
$style_header_pleft = array('align' => 'left');
$style_header_pright = array('align' => 'right');
$style_cell_pleft = array('align' => 'left');
$style_cell_pright = array('align' => 'right');
$section = $PHPWord->addSection();
$header = $section->addHeader();
$table = $header->addTable();
$table->addRow();
$cell = $table->addCell(9600);
$cell->addText($conference['name'], array('size' => '16'), array('align' => 'center'));
//print "<pre>" . print_r($timeslots, true) . "</pre>";
//exit;
//
// Create a table with a row for each time slot
//.........这里部分代码省略.........