function amp_badge_tag_cloud($options = array()) { $qty_set = isset($options['qty_set']) && $options['qty_set'] ? $options['qty_set'] : false; if (!$qty_set && !isset($options['section'])) { $qty_set = AMP_lookup('tag_totals_articles_by_section_live', AMP_current_section_id()); } if (!$qty_set && !$options['section']) { $qty_set = AMP_lookup('tag_totals_articles_live'); } if (!$qty_set && $options['section']) { $qty_set = AMP_lookup('tag_totals_articles_by_section_live', $options['section']); } if (!$qty_set) { return false; } $display_url = isset($options['display_url']) && $options['display_url'] ? $options['display_url'] : false; $source_item = new AMP_Content_Tag(AMP_Registry::getDbcon()); $source = $source_item->find(array('displayable' => 1)); if (!$source) { return false; } $display = new AMP_Display_Cloud($source, $qty_set); if ($display_url) { $display->set_url_method($display_url); } $renderer = AMP_get_renderer(); return $renderer->div($display->execute(), array('class' => 'tagcloud_badge')); }
function _init_class_displays() { $class = isset($this->_source_criteria['class']) && $this->_source_criteria['class'] ? $this->_source_criteria['class'] : false; if (!($class && is_array($class))) { return false; } $class_display_criteria = $this->_source_criteria; // class groups dont show content that also has a tag to be listed $tag = isset($this->_source_criteria['tag']) && $this->_source_criteria['tag'] ? $this->_source_criteria['tag'] : false; if ($tag && is_array($tag)) { unset($class_display_criteria['tag']); $class_display_criteria['not_tag'] = $tag; } require_once 'AMP/Content/Class.inc.php'; foreach ($class as $class_group) { $source = new ContentClass(AMP_Registry::getDbcon(), $class_group); $class_display_criteria['class'] = $class_group; $class_display = new $this->_grouped_list_class($null = 0, $class_display_criteria, $source->getListItemLimit()); $class_display->set_container($source); $class_display->_class_pager = 'AMP_Display_Pager_Morelinkplus'; $class_display->_path_pager = 'AMP/Display/Pager/Morelinkplus.php'; $class_display->set_pager_limit($this->_pager_limit, 'first'); if (!empty($this->_source_criteria['section'])) { $class_display->set_pager_request(array('type' => $this->_source_criteria['section'], 'class' => $class_group, 'list' => 'class')); } else { $class_display->set_pager_request(array('class' => $class_group, 'list' => 'class')); } $this->_group_displays['classes'][$class_group] = $class_display; } }
function amp_badge_related_form($data) { $data = array_merge($data, $_GET); foreach ($data as $key => $value) { if (is_array($value) && count($value) == 1) { $quick_val = array_values($value); $data[$key] = $quick_val[0]; } } $modin = isset($data['modin']) && $data['modin'] ? $data['modin'] : false; $related_index = isset($data['related_index']) && $data['related_index'] ? $data['related_index'] : false; if (!$modin) { return false; } if (!AMP_authenticate('admin')) { $live_forms = AMP_lookup('formsPublic'); if (!isset($live_forms[$modin])) { return 'Please publish the related form'; } } require_once 'AMP/UserData.php'; $udm =& new UserData(AMP_Registry::getDbcon(), $modin); $udm->registerPlugin('Output', 'Text'); $udm->setData($data); $renderer = AMP_get_renderer(); # $delete_button = $renderer->form( $delete_button = $renderer->link('#', $renderer->image(AMP_SYSTEM_ICON_DELETE, array('class' => 'icon', 'style' => 'border: 0;')), array('alt' => AMP_TEXT_DELETE_ITEM, 'title' => AMP_TEXT_DELETE_ITEM, 'onClick' => "\$('form_related_item_{$related_index}').remove( ); \$('form_{$modin}_related_custom_fields_{$related_index}').remove(); return false;")); $content = $delete_button . $renderer->tag('pre', $udm->doPlugin('Output', 'Text')); $result = $renderer->div($content, array('class' => 'form_related_item', 'id' => 'form_related_item_' . $related_index)); return $result; }
function export(&$target_set, $args = null) { $sample = current($target_set); $keys = $sample->export_keys(); $dump = array(); foreach ($keys as $key) { $blank_set[$key] = null; } foreach ($target_set as $source) { $values = $source->getData(); $user_values = array(); if (isset($values['uid']) && $values['uid']) { $owner = new AMP_System_User_Profile(AMP_Registry::getDbcon(), $values['uid']); if ($owner->hasData()) { $owner_data = $owner->getData(); unset($owner_data['id']); $user_values = array_combine_key($keys, $owner_data); } } $safe_values = array_combine_key($keys, $values); $dump[$source->id] = array_merge($blank_set, $safe_values, $user_values); } require_once 'AMP/Renderer/CSV.php'; $renderer = new AMP_Renderer_CSV(); $file = $renderer->format(array($keys)); $file .= $renderer->format($dump); $renderer->header(date("Y_m_d__") . get_class($this)); print $file; exit; }
function onDelete(&$source) { //delete all versions foreach (AMP_lookup('image_classes') as $current_class) { $fullpath = AMP_image_path($source->getName(), $current_class); if (!file_exists($fullpath)) { continue; } unlink($fullpath); } //remove gallery records require_once 'Modules/Gallery/Image/Set.inc.php'; $gallerySet =& new GalleryImageSet(AMP_Registry::getDbcon()); $gallerySet->deleteData($gallerySet->getCriteriaImage($source->getName())); $this->_list->removeSourceItemId($source->getName()); //clear image folder cache $this->_update_image_cache_delete($source->getName()); /* $cache = &_get_cache( ); if ( $cache ) { trigger_error( 'attempting cache delete with key ' . $source->getCacheKeySearch( )); $cache->delete( $source->getCacheKeySearch( ) ); } */ }
function setUp() { $dbcon = AMP_Registry::getDbcon(); $this->_udm = new UserDataInput($dbcon, 50, true); $this->_plugin = $this->_udm->registerPlugin('AMPCalendar', 'Read'); $this->_dia_plugin = $this->_udm->registerPlugin('DIAEvent', 'Read'); }
function saveUserData() { $json = new Services_JSON(); $debug = ''; foreach ($_GET as $key => $value) { $debug .= "{$key}: {$value}<br />"; } //Validate incoming User Data if ($_GET['Email'] == NULL || $_GET['Email'] == '') { $message = array('type' => 'bad', 'text' => 'Please Enter an Email Address'); $json_data = array('message' => $message, 'debug' => $debug); $output = $json->encode($json_data); return $output; } //Save User Data $userupdate = new AMP_User_Profile(AMP_Registry::getDbcon(), $_GET['Id']); $userdata = array('First_Name' => $_GET['First_Name'], 'Last_Name' => $_GET['Last_Name'], 'Company' => $_GET['Company'], 'Phone' => $_GET['Phone'], 'City' => $_GET['City'], 'Country' => $_GET['Country'], 'custom1' => $_GET['custom1'], 'custom4' => $_GET['custom4'], 'Email' => $_GET['Email']); if ($_GET['custom2'] != NULL || $_GET['custom2'] != '') { $userdata['custom2'] = $_GET['custom2']; } $userupdate->mergeData($userdata); $success = $userupdate->save(); //Check to see if save was successful, return $json_data = array(); if ($success == true) { $json_data['message'] = array('type' => 'good', 'text' => 'Changes Successfully Saved'); $json_data['success'] = true; } else { $json_data['message'] = array('type' => 'bad', 'text' => 'Save Failed'); } $json_data['debug'] = $debug; $output = $json->encode($json_data); return $output; }
function assign() { $currentPage =& AMPContent_Page::instance(); require_once 'AMP/Content/Article.inc.php'; $crit_builder = new Article(AMP_Registry::getDbcon()); $this->criteria = $crit_builder->makeCriteriaRelatedSection($currentPage->getSectionId()); }
function _load_target_field_defs() { require_once 'AMP/UserData.php'; $udm =& new UserData(AMP_Registry::getDbcon(), $this->_form_id, $admin = true); $fields_lookup = array(); $types_to_avoid = array("html", "static", "header"); $types_to_group = array('checkgroup', 'multiselect'); foreach ($udm->fields as $field_name => $field_def) { if (!(isset($field_def['enabled']) && $field_def['enabled']) || !isset($field_def['type'])) { continue; } if (array_search($field_def['type'], $types_to_group) !== FALSE) { $this->_group_fields[$field_name] = $field_def['label']; continue; } if (array_search($field_def['type'], $types_to_avoid) !== FALSE) { continue; } $label = $field_name; if (isset($field_def['label']) && $field_def['label']) { $label = $field_def['label']; } $fields_lookup[$field_name] = $label; } $fields_lookup['id'] = 'ID'; require_once 'AMP/System/User/Profile/Profile.php'; $user =& new AMP_System_User_Profile(AMP_Registry::getDbcon()); $db_fields = $user->getAllowedKeys(); foreach ($fields_lookup as $field_key => $field_label) { if (!isset($db_fields[strtoupper($field_key)])) { unset($fields_lookup[$field_key]); } } $this->_target_fields_lookup = $fields_lookup; }
function &createAppointment($user, $scheduleItem) { $dbcon =& AMP_Registry::getDbcon(); $appointment =& new Appointment($dbcon); $appointment->setParticipant($user); $appointment->setScheduleItem($scheduleItem); return $appointment; }
function getLinks($source = null) { if (!isset($source)) { require_once 'AMP/Content/Link/Link.php'; $source = new AMP_Content_Link(AMP_Registry::getDbcon()); } $source_set = $source->search($source->makeCriteria(array('linkType' => $this->id))); }
function get_arguments() { $args = $this->nav->getIncludeFunctionArguments(); require_once 'AMP/Content/Badge/Badge.php'; $badge = new AMP_Content_Badge(AMP_Registry::getDbcon()); $badge->setData(array('include_function_args' => $args)); return $badge->getIncludeFunctionArguments(); }
function execute() { $default_feed = new AMPContent_RSSFeed(AMP_Registry::getDbcon()); $default_feed->setDefaults(); $default_feed->mergeData(array("title" => "Latest Updates", "description" => "The most recently added pages on this website")); array_unshift($this->_source, $default_feed); return parent::execute(); }
function _initFormForWebAction(&$form, $action_id) { require_once 'Modules/WebAction/WebAction.php'; $dbcon =& AMP_Registry::getDbcon(); $publish_item =& new WebAction($dbcon, $_REQUEST['action']); $class_id = AMP_CONTENT_CLASS_ACTIONITEM; return $this->_initFormPublishItem($form, $publish_item, AMP_CONTENT_CLASS_ACTIONITEM); }
function &instance($component_map = null) { static $global_page = false; if (!$global_page) { $global_page = new AMPSystem_Page(AMP_Registry::getDbcon(), $component_map); } return $global_page; }
function _countArticles() { $articleset =& new ArticleSet(AMP_Registry::getDbcon()); if (!($counts = $articleset->getGroupedIndex('class'))) { return false; } return $counts; }
function &instance() { static $breadcrumb = false; if (!$breadcrumb) { $breadcrumb = new AMP_Breadcrumb_Content(AMP_Registry::getDbcon()); } return $breadcrumb; }
function setUp() { $this->dbcon = AMP_Registry::getDbcon(); $this->rs = $this->dbcon->Execute('select id from articles limit 1'); $this->assertTrue($this->rs, $this->dbcon->ErrorMsg()); $this->article = new Article($this->dbcon, $this->rs->fields[0]); $this->assertEqual(get_class($this->article), 'Article'); }
function getDisplayIntro() { if (!($intro = $this->getHeaderRef())) { $intro = new Article(AMP_Registry::getDbcon()); $intro->setDefaults(); $intro->mergeData(array('publish' => 1, 'title' => $this->getName() . $this->getListNameSuffix(), 'body' => $this->getBlurb(), 'class' => AMP_CONTENT_CLASS_SECTIONHEADER)); } return $intro->getDisplay(); }
function initResults() { $source_set =& new ArticleSet(AMP_Registry::getDbcon()); $this->_initSort($source_set); parent::init($source_set, false); $display_criteria =& new AMPContent_DisplayCriteria(); $display_criteria->clean($this->_source); $this->_source->applySearch($this->_searchForm->getSearchValues()); }
function execute() { require_once 'Modules/Podcast/Output/RSS.inc.php'; $id = $_REQUEST['id']; $dbcon = AMP_Registry::getDbcon(); $podcast = new Podcast($dbcon, $id); $rss = new Podcast_Output_RSS($podcast); return $rss->execute(); }
function _formFooter() { $id = $this->getIdValue(); if (!$id) { return false; } require_once 'AMP/Content/Tag/Item/List/Items.php'; $list =& new AMP_Content_Tag_Item_List_Items(AMP_Registry::getDbcon(), array('tag' => $id)); return $list->execute(); }
function _getPositionList($id = null) { if (isset($this->_positionList)) { return $this->_positionList->execute(); } $positionList =& new AMP_Content_Nav_Location_List(AMP_Registry::getDbcon()); $positionList->applySearch(array('layout_id' => $id)); $this->_positionList =& $positionList; return $positionList->execute(); }
function setUp() { $dbcon =& AMP_Registry::getDbcon(); $this->_udm =& new UserDataInput($dbcon, 50, true); $this->_udm->registerPlugin('AMPCalendar', 'Read'); $this->_plugin =& $this->_udm->registerPlugin( 'DIAEvent', 'Read'); $this->_plugin->setOptions ( $this->dia_account ); // $this->_populateUDM( ); // $this->_udm->doPlugin('QuickForm', 'Build'); }
function _addCriteriaSection() { require_once 'AMP/Content/Article.inc.php'; $article = new Article(AMP_Registry::getDbcon()); $crit = $article->makeCriteria($this->_section->getDisplayCriteria()); foreach ($crit as $crit_item) { $this->_source->addCriteria($crit_item); } #$this->_source->addCriteriaSection( $this->_section->id ); }
function setUp() { $dbcon = AMP_Registry::getDbcon(); $this->_udm = new UserDataInput($dbcon, 50, true); $this->_udm->registerPlugin('DIA', 'Save'); $this->_udm->registerPlugin('AMPCalendar', 'Save'); $this->_plugin = $this->_udm->registerPlugin('DIAEvent', 'Save'); $this->_populateUDM(); $this->_udm->doPlugin('QuickForm', 'Build'); }
function &_get_renderer() { if (isset($this->_renderer)) { return $this->_renderer; } require_once 'AMP/Content/Article/Comments.inc.php'; $fake_set = new AMPSystem_Data_Set(AMP_Registry::getDbcon()); $this->_renderer = new ArticleCommentSet_Display($fake_set); return $this->_renderer; }
function commit_update() { require_once 'AMP/Content/RSS/Subscription/Subscription.php'; $current_subscription_list =& AMPContent_Lookup::instance('RSS_Subscriptions'); foreach ($current_subscription_list as $subscription_id => $subscription_name) { $sub = new RSS_Subscription(AMP_Registry::getDbcon(), $subscription_id); $sub->update(); } AMP_flush_common_cache(); ampredirect(AMP_SYSTEM_URL_RSS_AGGREGATOR); }
function AMP_display_nav_tag_cloud() { $qty_set = AMPSystem_Lookup::instance('tagTotals'); if (!$qty_set) { return false; } $source_item =& new AMP_Content_Tag(AMP_Registry::getDbcon()); $source = $source_item->find(array('live' => AMP_CONTENT_STATUS_LIVE)); $display = new AMP_Display_Cloud($source, $qty_set); return $display->execute(); }
function _HTML_editColumn($id) { $source = new ArticleComment(AMP_Registry::getDbcon(), $id); $article_id = $source->getArticle(); $allowed_articles = AMP_lookup('articles'); $existing_articles = AMP_lookup('articles_existing'); if (!isset($allowed_articles[$article_id]) && isset($existing_articles[$article_id])) { return "\n<td nowrap><div align='center'>" . "</div></td>\n"; } return parent::_HTML_editColumn($id); }