本文整理汇总了PHP中AMP_Registry::getDbcon方法的典型用法代码示例。如果您正苦于以下问题:PHP AMP_Registry::getDbcon方法的具体用法?PHP AMP_Registry::getDbcon怎么用?PHP AMP_Registry::getDbcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMP_Registry
的用法示例。
在下文中一共展示了AMP_Registry::getDbcon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: amp_badge_tag_cloud
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'));
}
示例2: _init_class_displays
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;
}
}
示例3: amp_badge_related_form
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;
}
示例4: export
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;
}
示例5: onDelete
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( ) );
}
*/
}
示例6: setUp
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');
}
示例7: saveUserData
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;
}
示例8: assign
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());
}
示例9: _load_target_field_defs
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;
}
示例10: Appointment
function &createAppointment($user, $scheduleItem)
{
$dbcon =& AMP_Registry::getDbcon();
$appointment =& new Appointment($dbcon);
$appointment->setParticipant($user);
$appointment->setScheduleItem($scheduleItem);
return $appointment;
}
示例11: getLinks
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)));
}
示例12: get_arguments
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();
}
示例13: execute
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();
}
示例14: _initFormForWebAction
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);
}
示例15: AMPSystem_Page
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;
}