/** * Initializes the class with an id and an admin page * @param int id * @parm AdminPage $page * @return void */ function init($id, &$page) { $this->_id = $id; $this->admin_page =& $page; $this->_entity = new entity($id); $this->_user = new entity($this->admin_page->user_id); $this->_fields = get_fields_by_type($this->_entity->get_value('type'), true); }
function run() { if (!reason_user_has_privs($this->admin_page->user_id, 'edit')) { echo 'Sorry. You do not have privileges to edit live items on this site.'; return; } $fields = get_fields_by_type($this->admin_page->type_id); if (is_array($fields) && in_array($this->sorter->get_field(), $fields)) { if ($this->sorter->is_new()) { $this->sorter->show_links(); } else { // Disco stuff goes here! $sorterForm = new SorterForm(); $sorterForm->set_sorter($this->sorter); $sorterForm->user_id = $this->admin_page->user_id; $sorterForm->type_id = $this->admin_page->type_id; $sorterForm->site_id = $this->admin_page->site_id; $sorterForm->run(); // var_dump(unhtmlentities( $_SESSION[ 'listers' ][ $this->admin_page->site_id ][ $this->admin_page->type_id ] )); if (isset($_GET['savedTime'])) { $savedString = "This sorting last saved at: " . date("H:i:s m-d-Y", $_GET['savedTime']); } else { $savedString = "Not Saved."; } echo $savedString; } } else { echo 'This type is not sortable.'; } }
protected function publication_social_sharing_field_exists() { $fields = get_fields_by_type(id_of('publication_type')); return isset($fields['enable_social_sharing']); }
function &get_fields_for_type() { if (!isset($this->_fields_for_type)) { $type_id = $this->get_type_id(); $this->_fields_for_type = $this->get_fields_to_exclude() ? array_diff(get_fields_by_type($type_id), $this->get_fields_to_exclude()) : get_fields_by_type($type_id); } return $this->_fields_for_type; }
/** * Checks DB for all possible searchable_fields * @return void */ function viewer_searchable_fields() // {{{ { if($this->viewer_id) { $e = new entity( $this->viewer_id ); $fields = get_fields_by_type( $this->type_id ); $column_add = $e->get_left_relationship( 'view_searchable_fields' ); foreach( $column_add AS $value ) { if(!empty($fields[ $value->get_value( 'name' ) ] ) ) $this->add_filter( $value->get_value( 'name' ) ); } } } // }}}
function show_sorting() { $fields = get_fields_by_type($this->admin_page->type_id); $type = new entity($this->admin_page->type_id); $state = !empty($this->admin_page->request['state']) ? $this->admin_page->request['state'] : false; if (($type->get_value('custom_sorter') || is_array($fields) && in_array('sort_order', $fields)) && ($state == 'live' || !$state)) { echo '<div class="viewInfo"><div class="roundedTop"><img src="' . REASON_ADMIN_IMAGES_DIRECTORY . 'trans.gif" alt="" class="roundedCorner" /></div><div class="roundedContent">'; $link = $this->admin_page->make_link(array('cur_module' => 'Sorting', 'default_sort' => true)); echo '<a href="' . $link . '">Sort these items</a></div><div class="roundedBottom"><img src="' . REASON_ADMIN_IMAGES_DIRECTORY . 'trans.gif" alt="" class="roundedCorner" /></div></div><br />'; } }
function &get_classified_type_fields() { static $classified_type_fields; if (!isset($classified_type_fields)) { $classified_type_fields = get_fields_by_type(id_of('classified_type')); } return $classified_type_fields; }
protected function theme_changes_made() { $fields = get_fields_by_type(id_of('theme_type')); return in_array('theme_customizer', $fields); }