Exemplo n.º 1
0
function AMP_navCalendarSearchState()
{
    $renderer = new AMPDisplay_HTML();
    $add_link = $renderer->link(AMP_CONTENT_URL_EVENT_ADD, 'Post an Event', array('class' => 'homeeventslink'));
    $search_link = $renderer->link(AMP_CONTENT_URL_EVENT_SEARCH, 'Search Events', array('class' => 'homeeventslink'));
    $state_values = AMPSystem_Lookup::instance('Regions_US');
    $select_values = array('' => 'Select Your State');
    if ($state_values) {
        $select_values = $select_values + $state_values;
    }
    return $search_link . $renderer->newline() . '<form method="GET" action="' . AMP_CONTENT_URL_EVENT_LIST . '">' . AMP_buildSelect('state', $select_values, null, $renderer->makeAttributes(array('onChange' => 'if ( this.value != "") this.form.submit( );'))) . '<input name="search" value="Search" type="hidden">' . '</form>' . $renderer->newline() . $add_link . $renderer->newline();
}
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 function AMP_navCountDisplay_Section($section_id)
 {
     if (!$section_id) {
         return false;
     }
     if (is_array($section_id)) {
         return false;
     }
     static $renderer = false;
     static $layout_lists = false;
     static $layout_content = false;
     static $navcount_layouts = false;
     if (!$renderer) {
         $renderer = new AMPDisplay_HTML();
     }
     if (!$layout_lists) {
         $layout_lists =& AMPContent_Lookup::instance('navLayoutsBySectionList');
     }
     if (!$layout_content) {
         $layout_content =& AMPContent_Lookup::instance('navLayoutsBySection');
     }
     if (!$navcount_layouts) {
         $navcount_layouts =& AMPContent_Lookup::instance('navLayoutLocationCount');
     }
     $count_lists = false;
     $count_content = false;
     $layout_id_content = $layout_content ? array_search($section_id, $layout_content) : false;
     $layout_id_lists = $layout_lists ? array_search($section_id, $layout_lists) : false;
     $url_vars_lists = array('action=add', 'section_id_list=' . $section_id);
     $url_vars_content = array('action=add', 'section_id=' . $section_id);
     if ($layout_id_lists) {
         //$count_lists = "( " . $navcount_layouts[ $layout_id_lists   ] . " )";
         $count_lists = $navcount_layouts[$layout_id_lists];
         $url_vars_lists = array('id=' . $layout_id_lists);
     }
     if ($layout_id_content) {
         //$count_content = "(&nbsp;" . $navcount_layouts[ $layout_id_content ] . "&nbsp;)";
         $count_content = $navcount_layouts[$layout_id_content];
         $url_vars_content = array('id=' . $layout_id_content);
     }
     $navlink_lists = $renderer->link(AMP_URL_AddVars(AMP_SYSTEM_URL_NAV_LAYOUT, $url_vars_lists), $count_lists . $renderer->image('/img/list_page' . ($count_lists ? '' : '_create') . '.png'), array('title' => sprintf(AMP_TEXT_WHAT_FOR_WHAT, $count_content ? AMP_TEXT_SYSTEM_LINK_NAV_LAYOUT_EDIT : AMP_TEXT_SYSTEM_LINK_NAV_LAYOUT_CREATE, AMP_TEXT_LIST_PAGES)));
     $navlink_content = $renderer->link(AMP_URL_AddVars(AMP_SYSTEM_URL_NAV_LAYOUT, $url_vars_content), $count_content . $renderer->image('/img/content_page' . ($count_content ? '' : '_create') . '.png'), array('title' => sprintf(AMP_TEXT_WHAT_FOR_WHAT, $count_content ? AMP_TEXT_SYSTEM_LINK_NAV_LAYOUT_EDIT : AMP_TEXT_SYSTEM_LINK_NAV_LAYOUT_CREATE, AMP_TEXT_CONTENT_PAGES)));
     return $renderer->div($navlink_lists . $navlink_content, array('class' => 'icon'));
     return $renderer->in_P($navlink_lists . $renderer->newline() . $navlink_content);
 }
Exemplo n.º 4
0
 function _commit_crop_thumbnail($real_sizes)
 {
     $target_path = AMP_image_path($this->_model->getName(), AMP_IMAGE_CLASS_CROP);
     #AMP_mkdir( substr( $target_path, 0, strlen( $target_path ) - strlen( $this->_model->getName() - 1)));
     AMP_mkdir(dirname($target_path));
     $new_image =& $this->_model->crop($real_sizes['start_x'], $real_sizes['start_y'], $real_sizes['start_x'] + $real_sizes['width'], $real_sizes['start_y'] + $real_sizes['height']);
     if (!$new_image) {
         return $this->_commit_crop_failure();
     }
     $this->_model->write_image_resource($new_image, $target_path);
     $cropped_image = new AMP_System_File_Image($target_path);
     if (!$cropped_image->width) {
         return $this->_commit_crop_failure();
     }
     $target_path = AMP_image_path($this->_model->getName(), AMP_IMAGE_CLASS_THUMB);
     $thumb_ratio = AMP_IMAGE_WIDTH_THUMB / $cropped_image->width;
     $thumb_sizes = $this->_resize_ratio(array('height' => $cropped_image->height, 'width' => $cropped_image->width), $thumb_ratio);
     $thumb_image =& $cropped_image->resize($thumb_sizes['width'], $thumb_sizes['height']);
     if (!$thumb_image) {
         return $this->_commit_crop_failure(AMP_TEXT_THUMBNAIL);
     }
     $cropped_image->write_image_resource($thumb_image, $target_path);
     $renderer = new AMPDisplay_HTML();
     $this->message($renderer->image(AMP_image_url($this->_model->getName(), AMP_IMAGE_CLASS_CROP), array('border' => 1)) . $renderer->newline(2) . sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $cropped_image->getName() . $renderer->space() . AMP_TEXT_CROP), $this->_unique_action_key(), $this->_model->get_url_edit());
     return true;
 }