Example #1
0
 function render_toolbar_move(&$toolbar)
 {
     $folder_options = AMP_lookup('image_folders');
     $folder_options = array('' => sprintf(AMP_TEXT_SELECT, AMP_TEXT_FOLDER), DIRECTORY_SEPARATOR => "Default Folder") + $folder_options;
     $panel_contents = $this->_renderer->select('folder_name', null, $folder_options, array('class' => 'searchform_element')) . $this->_renderer->space(2) . "New Folder:" . $this->_renderer->input('new_folder_name', "", array('class' => 'searchform_element'));
     return $toolbar->add_panel('move', $panel_contents);
 }
Example #2
0
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;
}
Example #3
0
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'));
}
Example #4
0
 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 = &AMP_get_cache( );
     if ( $cache ) {
         trigger_error( 'attempting cache delete with key ' . $source->getCacheKeySearch( ));
         $cache->delete( $source->getCacheKeySearch( ) );
     }
     */
 }
Example #5
0
 function find_calendar_id($options)
 {
     //basic
     if (isset($options['calid']) && $options['calid']) {
         return $options['calid'];
     }
     //dia lookup
     if (isset($options['dia_event_key']) && $options['dia_event_key']) {
         $dia_calid = $this->lookup_calid_thru_dia($options['dia_event_key']);
         if ($dia_calid) {
             return $dia_calid;
         }
     }
     // Check for the existence of a userid.
     if (!$this->udm->uid) {
         return false;
     }
     $user_events = AMP_lookup('eventsByOwner', $this->udm->uid);
     if (!$user_events || empty($user_events)) {
         return false;
     }
     if (count($user_events) == 1) {
         return key($user_events);
     } elseif (isset($_REQUEST['calid']) && $_REQUEST['calid']) {
         $request_calid = $_REQUEST['calid'];
         if (isset($user_events[$request_calid])) {
             return $request_calid;
         }
     }
     return false;
 }
function nav_articles_by_date()
{
    $page =& AMPContent_Page::instance();
    if ($class = $page->getClassId()) {
        $date_values = AMP_lookup('classArticlesByDate', $class);
    } else {
        $date_values = AMP_lookup('articlesByDate');
    }
    if (!$date_values) {
        return false;
    }
    $output = array();
    $renderer = AMP_get_renderer();
    foreach ($date_values as $pretty_date => $qty) {
        $real_date = strtotime($pretty_date);
        $url['year'] = date('Y', $real_date);
        $url['month'] = date('m', $real_date);
        $url['offset'] = false;
        $url['qty'] = false;
        $new_url = AMP_url_update($_SERVER['REQUEST_URI'], $url);
        $output[] = $renderer->link($new_url, $pretty_date, array('class' => AMP_CONTENT_CSS_CLASS_NAV_LINK));
        if (count($output) == AMP_CONTENT_NAV_ARCHIVE_LIMIT) {
            break;
        }
    }
    return join($renderer->newline(), $output);
}
Example #7
0
 function adjustFields($fields)
 {
     if (!($id = $this->getIdValue())) {
         $id = null;
     }
     $nav_blocks = AMP_lookup('navBlocks');
     foreach ($nav_blocks as $block_name => $token) {
         $fields['order_tracker_' . $block_name] = array('type' => 'textarea', 'attr' => array('id' => 'order_tracker_amp_content_nav_location_values_' . $block_name));
     }
     //$fields['position_list']['default'] = $this->_getPositionList( $id );
     if (isset($id)) {
         $fields['layout_anchor_description']['default'] = $this->_describeLayoutAnchor($id);
         return $fields;
     }
     $requested_selectors = array_combine_key($this->_selector_fields, $_GET);
     if (!empty($requested_selectors)) {
         foreach ($requested_selectors as $selector => $value) {
             $fields[$selector]['type'] = 'select';
         }
         return $fields;
     }
     foreach ($fields as $key => $field_def) {
         if (array_search($key, $this->_selector_fields) === FALSE) {
             continue;
         }
         $fields[$key]['type'] = 'select';
     }
     return $fields;
 }
Example #8
0
 function render_nav_block($content, $position)
 {
     $nav_blocks = AMP_lookup('navBlocks');
     $nav_key = array_search(strtolower($position), $nav_blocks);
     $renderer = AMP_get_renderer();
     return $renderer->div($content, array('class' => AMP_CONTENT_CSS_CLASS_NAV_BLOCK, 'id' => sprintf(AMP_CONTENT_CSS_ID_NAV_BLOCK, $nav_key)));
 }
Example #9
0
 function AMPContent_DisplayCriteria()
 {
     $this->_excluded_classes = AMP_lookup('excluded_classes_for_display');
     if (AMP_CONTENT_CLASS_SECTIONFOOTER) {
         $this->_excluded_classes[] = AMP_CONTENT_CLASS_SECTIONFOOTER;
     }
 }
Example #10
0
 function isAllowed($action, $model_id = false)
 {
     $allowed_layouts = AMP_lookup('navLayouts');
     if ($model_id && !isset($allowed_layouts[$model_id])) {
         return false;
     }
     return parent::isAllowed($action, $model_id);
 }
Example #11
0
 function _register_options_dynamic()
 {
     $this->options['allowed_classes']['values'] = AMP_lookup('classes');
     $this->options['allowed_sections']['values'] = AMP_lookup('sectionMap');
     if (is_array($this->options['allowed_sections']['values'])) {
         $this->options['allowed_sections']['values'] = array(AMP_CONTENT_MAP_ROOT_SECTION => '-- ' . AMP_SITE_NAME . ' --') + $this->options['allowed_sections']['values'];
     }
 }
Example #12
0
 function setTool($tool_id)
 {
     $this->add_link_var('tool_id', $tool_id);
     $forms_list = AMP_lookup('formsByTool');
     if (isset($forms_list[$tool_id])) {
         $this->add_link_var('form_id', $forms_list[$tool_id]);
     }
 }
Example #13
0
 function getTemplate()
 {
     $id = $this->getData('id');
     $template_set = AMP_lookup('templates');
     if (!isset($template_set[$id])) {
         return $id;
     }
     return $id . ': ' . $template_set[$id];
 }
Example #14
0
 function render_editor_name($source)
 {
     $editor_id = $source->getLastEditorId();
     $user_names = AMP_lookup('users');
     if (!($editor_id && isset($user_names[$editor_id]))) {
         return false;
     }
     return $user_names[$editor_id];
 }
Example #15
0
 function render_position($source)
 {
     $positions = AMP_lookup('navPositions');
     $position_id = $source->getPosition();
     if (!$position_id) {
         return false;
     }
     $position_name = isset($positions[$position_id]) ? $positions[$position_id] : $position_id;
     return $this->_renderer->newline() . $this->_renderer->span($position_name, array('class' => AMP_CONTENT_CSS_CLASS_SYSTEM_FINEPRINT, 'title' => 'Nav Position'));
 }
Example #16
0
 function renderCopy(&$toolbar)
 {
     $renderer = AMP_get_renderer();
     $class_options = AMP_base_select_options(AMP_lookup('classes'), 'Select Class');
     $publicpage_options = AMP_base_select_options(AMP_lookup('introtexts'), 'Select Public Page');
     $section_options_content = AMP_base_select_options(AMP_lookup('sectionMap'), 'Select Section ( ' . AMP_TEXT_CONTENT_PAGES . ' )');
     $section_options_list = AMP_base_select_options(AMP_lookup('sectionMap'), 'Select Section ( ' . AMP_TEXT_LIST_PAGES . ' )');
     $copy_selects = array(AMP_TEXT_LIST_NAV_LAYOUT_TARGET_COPY, $renderer->newline(), AMP_buildSelect('section_id_content', $section_options_content, null, $renderer->makeAttributes(array('class' => 'searchform_element'))), AMP_buildSelect('section_id_list', $section_options_list, null, $renderer->makeAttributes(array('class' => 'searchform_element'))), $renderer->newline(), AMP_buildSelect('class_id', $class_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))), AMP_buildSelect('publicpage_id', $publicpage_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))), $renderer->newline());
     return $toolbar->addTab('copy', $copy_selects);
 }
Example #17
0
 function getBlock()
 {
     $blocks = AMP_lookup('navBlocks');
     $position = $this->getPosition();
     foreach ($blocks as $block_header => $token) {
         if (strpos(strtolower($position), strtolower($token)) === 0) {
             return $block_header;
         }
     }
 }
Example #18
0
 function getSectionKeys()
 {
     $sections = AMP_lookup('sections_live');
     $protected_sections = AMP_lookup('protected_sections');
     unset($sections[AMP_CONTENT_SECTION_ID_ROOT]);
     if ($protected_sections) {
         return array_diff(array_keys($sections), array_keys($protected_sections));
     }
     return array_keys($sections);
 }
Example #19
0
 function render_toolbar_subscribe(&$toolbar)
 {
     $list_options = AMP_lookup('lists');
     if (!$list_options) {
         $list_options = array('' => AMP_TEXT_NONE_AVAILABLE);
     } else {
         $list_options = array('' => 'Select List') + $list_options;
     }
     $list_select = array($this->_renderer->select('list_id', null, $list_options));
     return $toolbar->addTab('subscribe', $list_select);
 }
Example #20
0
 function setTool($tool_id)
 {
     $forms_list = AMP_lookup('formsByTool');
     $url_vars = array('tool_id=' . $tool_id);
     if (isset($forms_list[$tool_id])) {
         $url_vars[] = 'form_id=' . $forms_list[$tool_id];
     }
     $this->_url_add = AMP_url_add_vars(AMP_SYSTEM_URL_PUBLIC_PAGE_ADD, $url_vars);
     $this->editlink = AMP_url_add_vars($this->editlink, $url_vars);
     $this->addCriteria('modid=' . $tool_id);
 }
Example #21
0
 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);
 }
Example #22
0
 function AMPSystemLookup_FormsWithEvents()
 {
     $owned_events = AMP_lookup('calendarEventOwner');
     if (!$owned_events) {
         return;
     }
     $this->criteria = 'id in( ' . join(',', $owned_events) . ') GROUP BY modin ';
     $this->init();
     $allowed_forms = array_keys($this->dataset);
     $this->dataset = array_combine_key($allowed_forms, AMP_lookup('forms'));
 }
Example #23
0
 function _showState(&$source, $column_name)
 {
     $state_value = $source->getState();
     if (!is_numeric($state_value)) {
         return $state_value;
     }
     $state_set = AMP_lookup('states');
     if (isset($state_set[$state_value])) {
         return $state_set[$state_value];
     }
     return $state_value;
 }
Example #24
0
 function _access_permitted($source)
 {
     $existing_articles = AMP_lookup('articles_existing');
     if (!isset($existing_articles[$source->getArticleId()])) {
         return true;
     }
     $allowed_articles = AMP_lookup('articles');
     if (!isset($allowed_articles[$source->getArticleId()])) {
         return false;
     }
     return true;
 }
Example #25
0
 function render_body($source)
 {
     if (!($body = $source->getBody())) {
         return false;
     }
     $body = $source->isHtml() ? $body : converttext($body);
     //hot words
     if ($hw = AMP_lookup('hotwords')) {
         $body = str_replace(array_keys($hw), array_values($hw), $body);
     }
     return $this->_renderer->p(eval_includes($body), array('class' => $this->_css_class_body));
 }
Example #26
0
 function delete()
 {
     $gallery_image_ids = AMP_lookup('galleries_by_image', $this->getName());
     if ($gallery_image_ids) {
         require_once 'Modules/Gallery/Image.inc.php';
         $finder = new GalleryImage(AMP_Registry::getDbcon());
         $images = $finder->find(array('id' => array_keys($gallery_image_ids)));
         foreach ($images as $gallery_image) {
             $gallery_image->delete();
         }
     }
     return parent::delete();
 }
Example #27
0
 function _dbEdit($source, $column_name)
 {
     $db_images = AMP_lookup('db_images');
     if (!$db_images) {
         return false;
     }
     $image_db_id = array_search($source->getName(), $db_images);
     if ($image_db_id === FALSE) {
         return false;
     }
     $renderer =& $this->_getRenderer();
     return $renderer->link(AMP_url_update(AMP_SYSTEM_URL_IMAGES, array('id' => $image_db_id)), AMP_TEXT_EDIT);
 }
Example #28
0
 function load_sections($live_only = 0)
 {
     $allowed_sections = AMP_lookup('sectionMap');
     $lookup_name = $live_only ? 'sectionsLive' : 'sections';
     $section_names = array_combine_key(array_keys($allowed_sections), AMP_lookup($lookup_name));
     $article_locations = $this->_article->getAllSections();
     $section_list = array_combine_key($article_locations, $section_names);
     asort($section_list);
     if (defined('AMP_CUSTOM_ITEM_BLOG_SECTION')) {
         unset($section_list[AMP_CUSTOM_ITEM_BLOG_SECTION]);
     }
     return $section_list;
 }
Example #29
0
 function isAllowed($action, $model_id = false)
 {
     if ($model_id) {
         $allowed_articles = AMP_lookup('AllowedArticles');
         $articles = AMP_lookup('articles_existing');
         $model = $this->getComponent('source');
         $model->readData($model_id);
         $article_id = $model->getArticle();
         if (isset($articles[$article_id]) && !isset($allowed_articles[$article_id])) {
             return false;
         }
     }
     return parent::isAllowed($action, $model_id);
 }
Example #30
0
 function readUsername($username)
 {
     $names = AMP_lookup('users');
     if (!$names) {
         return false;
     }
     $key = array_keys($names, $username);
     if ($key = array_search($username, $names)) {
         $this->readData($key);
         return $key;
     }
     return false;
     //$this->addCriteria( 'name='.$this->dbcon->qstr( $username));
 }