first import

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-08 11:40:19 +02:00
commit 1bc61b12ad
8435 changed files with 1582817 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?php
/**
* @file
*/
// $Id: views_handler_argument_count.inc,v 1.1 2008/09/03 19:21:28 merlinofchaos Exp $
/**
* Argument handler that ignores the argument.
*/
class views_boxes_handler_argument_limit extends views_handler_argument {
/**
* Override options_form()
*
* We are just adding markup to warn that a pager acts after we do.
*/
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['must_not_be'] = array(
'#markup' => t('This argument will have no effect if a pager is in use.'),
);
}
/**
* Override default_actions() to remove actions that don't
* make sense for a count argument.
* @todo need to see if this is necessary
*/
function default_actions($which = NULL) {
if ($which) {
if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) {
return parent::default_actions($which);
}
return;
}
$actions = parent::default_actions();
unset($actions['summary asc']);
unset($actions['summary desc']);
return $actions;
}
/**
* Override the behavior of query() to prevent the query
* from being changed in any way.
*/
function query( $group_by = FALSE ) {
}
/**
* Override pre_query()
*
* We set the limit on the queue if we have a non wildcard value
*/
function pre_query() {
if (isset($this->view->args[$this->position])) {
$limit = $this->view->args[$this->position];
if ($limit != $this->options['exception']['value']) {
$this->view->query->set_limit($limit);
}
}
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* @file
*/
class views_boxes_handler_filter_sort extends views_handler_filter_in_operator {
function get_value_options() {
if (!isset($this->value_options)) {
$this->value_title = t('Sort Plugins');
$this->view->display_handler->get_handlers('sort');
$options = array();
foreach ($this->view->display_handler->handlers['sort'] as $key => $handler) {
// Only show items that have been exposed
// using the exposed filters means that the exposed form gets involved
// and we do not like the way it does it.
$name = $handler->options['ui_name'] ? $handler->options['ui_name'] : $key;
$options[$key] = $name;
}
$this->value_options = $options;
}
}
function query() {
// This should not be necessary but for some reason when we use
// $view->set_exposed_input() it is not making it to value
if (isset($this->view->exposed_input[$this->options['id']])) {
$this->value = $this->view->exposed_input[$this->options['id']];
}
if (!is_array($this->value)) {
$this->value = array($this->value => $this->value);
}
// Run though each value and grab the sort handler that we already have
// then reset the sort array on the view
// note this method lets us also change the order of the sort if
// it is set correctly on the way in.
if (!empty($this->value)) {
$pre_sort = array();
$sort_canidates = array();
$hit_sort = FALSE;
foreach ($this->view->sort as $key => $handle) {
if (in_array($key, $this->options['value'])) {
$sort_canidates[$key] = $handle;
$hit_sort = TRUE;
unset($this->view->sort[$key]);
}
elseif (!$hit_sort) {
$pre_sort[$key] = $handle;
unset($this->view->sort[$key]);
}
}
$sort_ordered = array();
foreach ($this->value as $key) {
$sort_ordered[$key] = $sort_canidates[$key];
}
$this->view->sort = $pre_sort + $sort_ordered + $this->view->sort;
}
}
}