function _formFooter() { $renderer =& AMP_get_renderer(); $current_section_edit_link = false; $current_class_edit_link = false; $base_footer = ' <a href="' . AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('nosearch=1')) . '" class="standout">' . sprintf(AMP_TEXT_VIEW_ALL, AMP_pluralize(ucfirst(AMP_TEXT_ARTICLE))) . '</a>'; //sectional edit link $current_section = isset($_REQUEST['section']) && $_REQUEST['section'] ? $_REQUEST['section'] : false; if (!$current_section) { $current_section = isset($_REQUEST['type']) && $_REQUEST['type'] ? $_REQUEST['type'] : false; } if ($current_section) { $section_names = AMPContent_Lookup::instance('sections'); $section_name = isset($section_names[$current_section]) ? $section_names[$current_section] : false; $current_section_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_SECTION, array('id=' . $current_section)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_SECTION . $renderer->space() . AMP_trimText($section_name, 20, false)); } //class edit link $current_class = isset($_REQUEST['class']) && $_REQUEST['class'] ? $_REQUEST['class'] : false; if ($current_class) { $class_names = AMPContent_Lookup::instance('classes'); $class_name = isset($class_names[$current_class]) ? $class_names[$current_class] : false; $current_class_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_CLASS, array('id=' . $current_class)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_CLASS . $renderer->space() . AMP_trimText($class_name, 20, false)); } return $base_footer . $current_section_edit_link . $current_class_edit_link . $renderer->newline(); }
function make_fields($values, $prefix = '') { $renderer = AMP_get_renderer(); $fields = array(); foreach ($values as $label => $value) { $current_label = $prefix ? $prefix . '_' . $label : $label; $current_label = str_replace(' ', '_', $current_label); if (is_array($value)) { $fields[$current_label] = $this->field_header; $fields[$current_label]['label'] = AMP_pluralize(ucwords(str_replace('_', ' ', $current_label))); $sub_fields = $this->make_fields($value, $current_label); $fields = $fields + $sub_fields; continue; } $base_field = $this->field_standard; if (is_numeric($value) and !is_bool($value)) { $base_field = $this->field_numeric; } if (is_bool($value)) { $base_field = $this->field_boolean; } if (isset($this->_config_text[$label])) { $fields[$current_label . '__comment'] = array('type' => 'static', 'default' => $renderer->div($this->_config_text[$label], array('class' => 'config_comment'))); } $fields[$current_label] = $base_field; $fields[$current_label]['label'] = ucwords(str_replace('_', ' ', $label)) . $renderer->newline() . $renderer->span('amp_' . $current_label, array('class' => 'photocaption')); $fields[$current_label]['default'] = $value; } return $fields; }
function setScaffoldItem($scaffold_item) { if (!$scaffold_item) { return false; } $this->_scaffold_item = $scaffold_item; $this->setDataTable(strtolower(AMP_pluralize($scaffold_item))); }
function init_controller_by_route($route) { $resource_class = ucfirst($route['target_type']); $controller_class = "AMP_Controller_" . AMP_pluralize($resource_class); $controller_path = str_replace('_', '/', $controller_class) . ".php"; require_once $controller_path; $controller = new $controller_class(AMP_dbcon(), $route['target_id']); $controller->set_action('show'); $controller->set_params(array('id' => $route['target_id'])); return $controller; }
function _HTML_commentLink(&$commentSet) { $commentSet->execute(); $renderer = AMP_get_renderer(); $text = $commentSet->RecordCount() ? $commentSet->RecordCount() . ' ' . AMP_pluralize(AMP_TEXT_COMMENT) : AMP_TEXT_NO_COMMENTS; $comments = $renderer->link(AMP_Url_AddAnchor($this->_article->getURL(), 'comments'), $text); $sections_output = ''; $sections = $this->render_sections(); if ($sections) { $sections_output = AMP_TEXT_POSTED_IN . $renderer->space() . $sections; } return $renderer->div($sections_output . $renderer->separator() . $comments, array('align' => 'right')) . $renderer->newline() . $renderer->hr() . $renderer->newline(); }
function _register_fields_dynamic() { $available_tags = AMPSystem_Lookup::instance('tags'); if (!$available_tags) { return false; } $options = $this->getOptions(); $public_setting = isset($options['public']) && $options['public']; $this->_active = $public_setting || $this->udm->admin; $fields = array('tag_add' => array('type' => 'multiselect', 'size' => 12, 'label' => 'Select ' . ucfirst(AMP_pluralize(AMP_TEXT_TAG)), 'enabled' => true, 'public' => $public_setting, 'values' => $available_tags), 'tag_add_text' => array('type' => 'text', 'size' => 30, 'label' => 'Add ' . ucfirst(AMP_pluralize(AMP_TEXT_TAG)) . ' ( comma-separated )', 'enabled' => true, 'public' => $public_setting)); $this->fields =& $fields; $this->insertAfterFieldOrder(array('tag_list', 'tag_add', 'tag_add_text')); }
function format($dataset = null, $quot = '"') { if (!(isset($dataset) && $dataset && is_array($dataset))) { trigger_error(sprintf(AMP_TEXT_ERROR_NO_SELECTION, AMP_pluralize(AMP_TEXT_ITEM_NAME))); return false; } $str = ''; $escape_function = "escapeforcsv"; foreach ($dataset as $row) { array_walk($row, array($this, $escape_function, $this->delimiter)); $str .= implode($this->delimiter, $row) . "\n"; } return $str; }
function pagetitle($item = null, $verb = null) { if (!isset($verb)) { $verb = $this->page->action; } if (!isset($item)) { $item = $this->itemtype; } $plural_actions = array('View'); if (array_search($verb, $plural_actions) !== FALSE) { $item = AMP_pluralize($item); } return "<div class = \"banner\">{$verb} {$item}</div>"; }
function _listLink($options = array()) { if (!isset($options['_linked_uid'])) { return false; } $comment_count_lookup = FormLookup::instance('commentCounts'); $comment_count = isset($comment_count_lookup[$options['_linked_uid']]) ? $comment_count_lookup[$options['_linked_uid']] : 0; $link_text = ($comment_count ? $comment_count : AMP_TEXT_NO) . ' ' . AMP_pluralize(AMP_TEXT_COMMENT); $renderer =& $this->_get_renderer(); //current comment count $comments = $renderer->link(AMP_Url_AddAnchor(AMP_Url_AddVars(PHP_SELF_QUERY(), array('uid=' . $options['_linked_uid'])), 'comments'), $link_text); //add comment link $comments .= $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_CONTENT_URL_COMMENT_ADD, array('userdata_id=' . $options['_linked_uid'])), AMP_TEXT_ADD); return $comments . $renderer->newline(2); }
function getItemCategory() { $item_type = $this->getItemtype(); $name_value = false; if ($item_type == AMP_TEXT_SYSTEM_ITEM_TYPE_FORM) { $form_id = $this->_tagged_item->getModin(); if (!$form_id) { return false; } $form_names = AMPSystem_Lookup::instance('formsPublic'); if (isset($form_names[$form_id])) { return $form_names[$form_id]; } } return AMP_pluralize(ucfirst($item_type)); }
function commit_view() { $status_display =& $this->_map->getComponent('status'); $this->_display->add($status_display, 'status'); $search =& $this->_map->getComponent('search', 'AMP_Content_Search'); $this->add_component_header(AMP_TEXT_SEARCH, AMP_pluralize($this->_map->getHeading())); $this->_display->add($search, 'search'); $search->Build(true); //if ( !$search->submitted( )) $search->applyDefaults(); $menu_display =& $this->_map->getComponent('menu'); $class_display =& $this->_map->getComponent('classlinks'); $this->add_component_header(AMP_TEXT_CONTENT_MAP_HEADING, ""); $this->_display->add($menu_display, 'menu'); $this->add_component_header(AMP_TEXT_VIEW, AMP_TEXT_BY . " " . ucfirst(AMP_TEXT_CLASS)); $this->_display->add($class_display, 'class'); $this->_clear_list_location(); }
function execute($options = array()) { $options = array_merge($this->getOptions(), $options); require_once 'AMP/UserData/Lookups.inc.php'; $index_title = AMP_pluralize($this->udm->name) . " By " . $options['index_name']; $index_set =& FormLookup_Variant::instance($options['index_field'], $this->udm->instance); #$index['state']['sql'].="SELECT count(userdata.id) as qty, userdata.State as item_key, states.statename as item_name from userdata, states WHERE userdata.State=states.state and modin=".$_REQUEST['modin']." GROUP BY userdata.State "; $translated_values = isset($this->_region_lookups[$options['index_field']]) ? AMPSystem_Lookup::locate($this->_region_lookups[$options['index_field']]) : AMPSystem_Lookup::locate(array('instance' => AMP_pluralize($options['index_field']))); require_once 'AMP/Content/Display/HTML.inc.php'; $renderer = new AMPDisplay_HTML(); $output = $renderer->bold($index_title) . $renderer->newline(); foreach ($index_set as $index_value => $index_count) { $display_value = $translated_values && isset($translated_values[$index_value]) ? $translated_values[$index_value] : $index_value; $display_value .= ' (' . $index_count . ')'; $link_value = AMP_URL_AddVars($_SERVER['PHP_SELF'], array($options['index_field'] => strtolower($options['index_field']) . '=' . $index_value, 'modin' => 'modin=' . $this->udm->instance)); $output .= $renderer->link($link_value, $display_value) . $renderer->newline(); #$output .= '<a href="'.$_SERVER['PHP_SELF'].'?'.$options['index_field'].'='.$index_value.'&modin='.$_REQUEST['modin'].'">'.$index_item['item_name'].'</a> ('.$index_item['qty'].')<BR>'; } return $output; }
function set_banner($action = null, $heading) { $text = ucfirst(isset($action) ? $action : join("", $this->get_actions())); $plural_headings = array(AMP_TEXT_LIST, AMP_TEXT_SEARCH, AMP_TEXT_VIEW); if (array_search($text, $plural_headings) !== FALSE) { $heading = AMP_pluralize($heading); } $this->add_component_header($text, ucwords($heading), 'banner', AMP_CONTENT_DISPLAY_KEY_INTRO); $header_text = $text . ' ' . $heading; $header =& AMP_getHeader(); $header->setPageAction($header_text); }
function makeCriteriaTag($tag_value) { if (!isset($this->_item_type)) { trigger_error(sprintf(AMP_TEXT_ERROR_NOT_DEFINED, get_class($this), '_item_type')); trigger_error(sprintf(AMP_TEXT_ERROR_CREATE_FAILED, get_class($this), 'tag criteria ' . $tag_value)); return false; } $lookup_type = AMP_pluralize($this->_item_type) . 'ByTag'; $id_set = AMPSystem_Lookup::instance($lookup_type, $tag_value); if (!$id_set || empty($id_set)) { return 'FALSE'; } return $this->id_field . ' IN ( ' . join(',', array_keys($id_set)) . ')'; }
function _HTML_searchForm() { if (!isset($this->_search_form)) { return false; } $renderer = $this->_getRenderer(); return $renderer->inSpan(AMP_TEXT_SEARCH . ' ' . AMP_pluralize($this->_map->getHeading()), array('class' => 'intitle')) . "\n" . $this->_search_form->execute(); }
function render_comments($source) { $comments = AMP_lookup('comments_live_by_article', $source->id); $text = empty($comments) ? AMP_TEXT_NO_COMMENTS : count($comments) . ' ' . AMP_pluralize(AMP_TEXT_COMMENT); return $this->_renderer->link(AMP_Url_AddAnchor($source->getURL(), 'comments'), $text); }
function AMP_allow($action, $item_type, $id, $user_id = null) { if ($action == 'cancel') { return true; } /* $action = 'access'; if ( !$user_id ) $user_id = AMP_SYSTEM_USER_ID; $crit_array = array( 'target_id' => $id, 'user_id' => $user_id, 'action' => $action, 'allow' => 1 ); $target_permission_lookup = AMP_lookup( 'permissionTarget'.ucfirst( $item_type ), $id ); if ( !$permission_lookup ) return true; return ( isset( $permission_lookup[$id]) && $permission_lookup[$id] == $action) ; */ //this code applies only in ACL mode. not currently in use $action_translations = array('edit' => 'access', 'publish' => 'publish', 'unpublish' => 'publish', 'move' => 'save', 'reorder' => 'save', 'list' => 'access', 'copy' => 'create', 'trash' => 'delete'); if (defined('AMP_SYSTEM_PERMISSIONS_LOADING') || !defined('AMP_SYSTEM_USER_ID_ACL')) { return true; } if (!defined($user_id)) { $user_id = AMP_SYSTEM_USER_ID_ACL; } $gacl =& AMP_acl(); if (isset($action_translations[$action])) { $action = $action_translations[$action]; } #trigger_error( 'checking ' . $action . ' for ' . AMP_SYSTEM_USER_TYPE . ' #' . $user_id . ' on ' . AMP_pluralize( $item_type ) . ' or ' . $item_type . '_' . $id ); return $gacl->acl_check('commands', $action, AMP_SYSTEM_USER_TYPE, $user_id, AMP_pluralize($item_type), $item_type . '_' . $id); }
function renderTag(&$toolbar) { $renderer = AMP_get_renderer(); $tags = AMPSystem_Lookup::instance('tags'); if (!$tags) { $tags = array(); } $tag_add = $renderer->inSpan(AMP_TEXT_ADD . $renderer->space() . AMP_pluralize(AMP_TEXT_TAG) . ': ', array('class' => 'searchform_element')) . '<input name = "tags_text" type="text" class="searchform_element">'; $tag_options = array('' => 'Select ' . AMP_pluralize(ucfirst(AMP_TEXT_TAG))) + $tags; $tag_selects = array(AMP_buildSelect('tag_id', $tag_options, null, $renderer->makeAttributes(array('class' => 'searchform_element'))), $tag_add); return $toolbar->addTab('tag', $tag_selects); }
function define_form($options = array()) { $options = array_merge($this->getOptions(), $options); //Each of these sets the List_Action value of the form and submits the form //Selected items are posted in id //Intro text $def['intro'] = array('type' => 'static', 'label' => '<span class="' . $options['control_class'] . '"><B>With Selected:</B></span>', 'enabled' => true, 'public' => true); //Publish Button $def['publish'] = array('type' => 'button', 'label' => 'Publish', 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'publish' );"), 'enabled' => $options['allow_publish']); //Unpublish Button $def['unpublish'] = array('type' => 'button', 'label' => 'Unpublish', 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'unpublish' );"), 'enabled' => $options['allow_publish']); //Delete Button $def['delete'] = array('type' => 'button', 'label' => 'Delete', 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'delete' );"), 'enabled' => $this->udm->admin && $options['allow_delete']); //Export Button $def['export'] = array('type' => 'button', 'label' => 'Export', 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'export' );"), 'public' => $options['allow_export'], 'enabled' => $options['allow_export']); //Email Button $def['email'] = array('type' => 'button', 'label' => 'Email', 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'email' );"), 'enabled' => $options['allow_email']); //Subscribe Options $def['blastlist_id'] = array('type' => 'select', 'label' => 'Subscribe to', 'enabled' => AMP_authorized(AMP_PERMISSION_BLAST_ACCESS), 'attr' => array('class' => $options['control_class']), 'values' => AMPSystem_Lookup::instance('lists')); //Subscribe Button $def['subscribe'] = array('type' => 'button', 'label' => 'Subscribe', 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'subscribe' );"), 'enabled' => AMP_authorized(AMP_PERMISSION_BLAST_ACCESS)); //Tag Items if ($tag_plugin = $this->udm->getPlugin('Tags', 'Start')) { $def['tag_action_id'] = array('type' => 'select', 'label' => sprintf(AMP_TEXT_SELECT, AMP_TEXT_TAG), 'enabled' => true, 'attr' => array('class' => $options['control_class']), 'values' => AMPSystem_Lookup::instance('tags')); $def['tag_action_add'] = array('type' => 'text', 'label' => AMP_TEXT_ADD . ' ' . AMP_pluralize(AMP_TEXT_TAG) . ': ', 'enabled' => true, 'attr' => array('class' => $options['control_class'])); $def['tag'] = array('type' => 'button', 'label' => ucfirst(AMP_TEXT_TAG), 'attr' => array('class' => $options['control_class'], 'onClick' => "list_DoAction( 'tag' );"), 'enabled' => true); } //list_action form items $def['list_action'] = array('type' => 'hidden', 'value' => '', 'enabled' => true); $def['list_action_id'] = array('type' => 'hidden', 'value' => '', 'enabled' => true); $def['sqlp'] = array('type' => 'hidden', 'value' => '', 'enabled' => true); $def['list_return_url'] = array('type' => 'hidden', 'value' => '', 'enabled' => true); /*pager compatibility*/ $def['qty'] = array('type' => 'hidden', 'value' => '', 'enabled' => true); $def['offset'] = array('type' => 'hidden', 'value' => '', 'enabled' => true); return $def; }
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(); $safe_values = array_combine_key($keys, $values); $dump[$source->id] = array_merge($blank_set, $safe_values); if ($exp_values = $source->before_export($safe_values)) { $dump[$source->id] = array_merge($blank_set, $safe_values, $exp_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__") . AMP_pluralize(get_class($sample))); print $file; exit; }
function renderItem($source) { $descriptor = count($source) > 1 ? AMP_pluralize(AMP_TEXT_TAG) : AMP_TEXT_TAG; $text = ucwords($descriptor . ':' . $this->_renderer->space()) . join(', ', array_map(array($this, 'render_name'), $source)); return $this->_renderer->div($text, array('class' => AMP_CONTENT_CSS_CLASS_LIST_SUBHEADER)); }
function _init_names() { if (!$this->dataset) { return; } if (!($this->_criteria_item == 'form')) { $lookup_name = AMP_pluralize($this->_criteria_item); } else { $lookup_name = 'formNames'; } $lookup_values = AMPSystem_Lookup::instance($lookup_name); if (!$lookup_values) { return; } $this->dataset = array_combine_key(array_keys($this->dataset), $lookup_values); }
function _renderHeader() { return $this->_renderer->inDiv(ucfirst(AMP_pluralize(AMP_TEXT_TAG)), array('class' => 'system_heading list_header')); }
function renderRecalculate(&$toolbar) { $renderer =& $this->_getRenderer(); $toolbar->addEndContent($renderer->inDiv('<a name="recalculate_sizes"></a>' . $renderer->bold(AMP_TEXT_SELECT_NEW_WIDTHS_FOR . ':') . $renderer->newline(2) . ucwords(AMP_pluralize(AMP_TEXT_IMAGE_CLASS_THUMB)) . ': ' . '<input name="image_width_thumb" value=' . AMP_IMAGE_WIDTH_THUMB . ' class="searchform_element" size="4">' . $renderer->space(2) . ucwords(AMP_pluralize(AMP_TEXT_IMAGE_CLASS_OPTIMIZED_TALL)) . ': ' . '<input name="image_width_tall" value=' . AMP_IMAGE_WIDTH_TALL . ' class="searchform_element" size="4">' . $renderer->space(2) . ucwords(AMP_pluralize(AMP_TEXT_IMAGE_CLASS_OPTIMIZED_WIDE)) . ': ' . '<input name="image_width_wide" value=' . AMP_IMAGE_WIDTH_WIDE . ' class="searchform_element" size="4">' . $renderer->space(2) . $renderer->newline(2) . ' ' . "<input type='submit' name='" . $toolbar->submitGroup . "[recalculate]' value='" . AMP_TEXT_RECALCULATE . "' onclick='return confirmSubmit( \"" . AMP_TEXT_LIST_CONFIRM_RECALCULATE_IMAGES . "\");'>" . ' ' . "<input type='button' name='hideRecalculate' value='" . AMP_TEXT_CANCEL . "' onclick='window.change_any( \"recalculate_sizes\");'> ", array('class' => 'AMPComponent_hidden', 'id' => 'recalculate_sizes')), 'recalculate_sizes'); return " | " . AMP_TEXT_ALL_IMAGE_SIZES . ": <input type='button' name='showRecalculate' value='" . AMP_TEXT_RECALCULATE . "' onclick='window.change_any( \"recalculate_sizes\");if ( \$(\"gallery_targeting\").style.display==\"block\") window.change_any( \"gallery_targeting\" );window.scrollTo( 0, document.anchors[\"recalculate_sizes\"].y );'> "; }
function _HTML_header() { return '<div class="tag_listing">' . '<div class="system_heading list_header">Current ' . ucfirst(AMP_pluralize(AMP_TEXT_TAG)) . '</div>'; }
function _formFooter() { $renderer = AMP_get_renderer(); return $renderer->link(AMP_url_add_vars(AMP_SYSTEM_URL_GALLERY_IMAGE, array('action=clear_bookmark')), sprintf(AMP_TEXT_VIEW_ALL, ucfirst(AMP_pluralize(AMP_TEXT_IMAGE)))) . join($renderer->newline(), $this->_preview_links); }
function render_toolbar_recalculate(&$toolbar) { $panel_contents = $this->_renderer->bold(AMP_TEXT_SELECT_NEW_WIDTHS_FOR . ':') . $this->_renderer->newline(2) . ucwords(AMP_pluralize(AMP_TEXT_IMAGE_CLASS_THUMB)) . ': ' . $this->_renderer->input('image_width_thumb', AMP_IMAGE_WIDTH_THUMB, array('class' => 'searchform_element', 'size' => '4')) . $this->_renderer->space(2) . ucwords(AMP_pluralize(AMP_TEXT_IMAGE_CLASS_OPTIMIZED_TALL)) . ': ' . $this->_renderer->input("image_width_tall", AMP_IMAGE_WIDTH_TALL, array('class' => 'searchform_element', 'size' => '4')) . $this->_renderer->space(2) . ucwords(AMP_pluralize(AMP_TEXT_IMAGE_CLASS_OPTIMIZED_WIDE)) . ': ' . $this->_renderer->input("image_width_wide", AMP_IMAGE_WIDTH_WIDE, array('class' => 'searchform_element', 'size' => '4')) . $this->_renderer->space(2) . $this->_renderer->newline(2); return $this->_renderer->space() . $this->_renderer->separator() . $this->_renderer->space() . $toolbar->add_panel('recalculate', $panel_contents); }