+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-
-require_once 'CRM/Auction/DAO/Auction.php';
-
-/**
- * Class CRM_Auction_BAO_Auction
- */
-class CRM_Auction_BAO_Auction extends CRM_Auction_DAO_Auction {
-
- /**
- * class constructor
- */
- function __construct() {
- parent::__construct();
- }
-
- /**
- * Fetch object based on array of properties
- *
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $defaults (reference ) an assoc array to hold the flattened values
- *
- * @return CRM_Auction_BAO_Auction object
- */
- static function retrieve(&$params, &$defaults) {
- $auction = new CRM_Auction_DAO_Auction();
- $auction->copyValues($params);
- if ($auction->find(TRUE)) {
- CRM_Core_DAO::storeValues($auction, $defaults);
- return $auction;
- }
- return NULL;
- }
-
- /**
- * update the is_active flag in the db
- *
- * @param int $id id of the database record
- * @param boolean $is_active value we want to set the is_active field
- *
- * @return Object DAO object on sucess, null otherwise
- */
- static function setIsActive($id, $is_active) {
- return CRM_Core_DAO::setFieldValue('CRM_Auction_DAO_Auction', $id, 'is_active', $is_active);
- }
-
- /**
- * add the auction
- *
- * @param array $params reference array contains the values submitted by the form
- * @return object
- */
- static function add(&$params) {
- if (!empty($params['id'])) {
- CRM_Utils_Hook::pre('edit', 'Auction', $params['id'], $params);
- }
- else {
- CRM_Utils_Hook::pre('create', 'Auction', NULL, $params);
- }
-
- $auction = new CRM_Auction_DAO_Auction();
-
- $auction->copyValues($params);
- $result = $auction->save();
-
- if (!empty($params['id'])) {
- CRM_Utils_Hook::post('edit', 'Auction', $auction->id, $auction);
- }
- else {
- CRM_Utils_Hook::post('create', 'Auction', $auction->id, $auction);
- }
-
- return $result;
- }
-
- /**
- * create the auction
- *
- * @param array $params reference array contains the values submitted by the form
- *
- * @return object
- */
- public static function create(&$params) {
- $transaction = new CRM_Core_Transaction();
-
- $auction = self::add($params);
-
- if (is_a($auction, 'CRM_Core_Error')) {
- CRM_Core_DAO::transaction('ROLLBACK');
- return $auction;
- }
-
- $transaction->commit();
-
- return $auction;
- }
-
- /**
- * delete the auction
- *
- * @param int $id auction id
- *
- */
- static function del($id) {
- $auction = new CRM_Auction_DAO_Auction();
- $auction->id = $id;
- $result = $auction->delete();
- return $result;
- }
-
- /**
- * Function to get current/future Auctions
- *
- * @param $all boolean true if auctions all are required else returns current and future auctions
- *
- * @param bool $id
- *
- * @return array
- */
- static function getAuctions($all = FALSE, $id = FALSE) {
- $query = "SELECT `id`, `title`, `start_date` FROM `civicrm_auction`";
-
- if (!$all) {
- $endDate = date('YmdHis');
- $query .= " WHERE `end_date` >= {$endDate} OR end_date IS NULL";
- }
- if ($id) {
- $query .= " WHERE `id` = {$id}";
- }
-
- $query .= " ORDER BY title asc";
- $auctions = array();
-
- $dao = &CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
- while ($dao->fetch()) {
- $auctions[$dao->id] = $dao->title . ' - ' . CRM_Utils_Date::customFormat($dao->start_date);
- }
-
- return $auctions;
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-
-require_once 'CRM/Auction/DAO/Auction.php';
-
-/**
- * Class CRM_Auction_BAO_Item
- */
-class CRM_Auction_BAO_Item extends CRM_Auction_DAO_Auction {
-
- /**
- * class constructor
- */
- function __construct() {
- parent::__construct();
- }
-
- /**
- * Fetch object based on array of properties
- *
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $defaults (reference ) an assoc array to hold the flattened values
- *
- * @return CRM_Auction_BAO_Item object
- */
- static function retrieve(&$params, &$defaults) {
- $auction = new CRM_Auction_DAO_Item();
- $auction->copyValues($params);
- if ($auction->find(TRUE)) {
- CRM_Core_DAO::storeValues($auction, $defaults);
- return $auction;
- }
- return NULL;
- }
-
- /**
- * update the is_active flag in the db
- *
- * @param int $id id of the database record
- * @param boolean $is_active value we want to set the is_active field
- *
- * @return Object DAO object on sucess, null otherwise
- */
- static function setIsActive($id, $is_active) {
- return CRM_Core_DAO::setFieldValue('CRM_Auction_DAO_Item', $id, 'is_active', $is_active);
- }
-
- /**
- * add the auction
- *
- * @param array $params reference array contains the values submitted by the form
- * @return object
- */
- static function add(&$params) {
- if (!empty($params['id'])) {
- CRM_Utils_Hook::pre('edit', 'Auction_Item', $params['id'], $params);
- }
- else {
- CRM_Utils_Hook::pre('create', 'Auction_Item', NULL, $params);
- }
-
- $auction = new CRM_Auction_DAO_Item();
-
- $auction->copyValues($params);
- $auction->save();
-
- // add attachments as needed
- CRM_Core_BAO_File::formatAttachment($params,
- $params,
- 'civicrm_auction_item',
- $auction->id
- );
- // add attachments as needed
- CRM_Core_BAO_File::processAttachment($params,
- 'civicrm_auction_item',
- $auction->id
- );
-
- if (!empty($params['id'])) {
- CRM_Utils_Hook::post('edit', 'Auction_Item', $auction->id, $auction);
- }
- else {
- CRM_Utils_Hook::post('create', 'Auction_Item', $auction->id, $auction);
- }
-
- return $result;
- }
-
- /**
- * create the auction
- *
- * @param array $params reference array contains the values submitted by the form
- *
- * @return object
- */
- public static function create(&$params) {
- $transaction = new CRM_Core_Transaction();
-
- $auction = self::add($params);
-
- if (is_a($auction, 'CRM_Core_Error')) {
- CRM_Core_DAO::transaction('ROLLBACK');
- return $auction;
- }
-
- $transaction->commit();
-
- return $auction;
- }
-
- /**
- * delete the auction
- *
- * @param int $id auction id
- */
- static function del($id) {
- $auction = new CRM_Auction_DAO_Item();
- $auction->id = $id;
- $result = $auction->delete();
- return $result;
- }
-
- /**
- * Function to check if email is enabled for a given profile
- *
- * @param $profileId
- *
- * @internal param int $id profile id
- *
- * @return boolean
- */
- static function isEmailInProfile($profileId) {
- $query = "
-SELECT field_name
-FROM civicrm_uf_field
-WHERE field_name like 'email%' And is_active = 1 And uf_group_id = %1";
-
- $params = array(1 => array($profileId, 'Integer'));
- $dao = CRM_Core_DAO::executeQuery($query, $params);
- if (!$dao->fetch()) {
- return TRUE;
- }
- return FALSE;
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- * Config handles all the run time configuration changes that the system needs to deal with.
- * Typically we'll have different values for a user's sandbox, a qa sandbox and a production area.
- * The default values in general, should reflect production values (minimizes chances of screwing up)
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Component/Config.php';
-
-/**
- * Class CRM_Auction_Config
- */
-class CRM_Auction_Config extends CRM_Core_Component_Config {}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Controller.php';
-require_once 'CRM/Core/Session.php';
-
-/**
- * This class is used for item create functionality.
- *
- * - the controller is used for building/processing multiform
- * searches.
- *
- * Typically the first form will be used to create account if not already exists
- *
- * The second form is used to add items
- *
- */
-class CRM_Auction_Controller_Item extends CRM_Core_Controller {
-
- /**
- * class constructor
- * @param null $title
- * @param bool|int $action
- * @param bool $modal
- */
- function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
- require_once 'CRM/Auction/StateMachine/Item.php';
- parent::__construct($title, $modal);
-
- $this->_stateMachine = new CRM_Auction_StateMachine_Item($this, $action);
-
- // create and instantiate the pages
- $this->addPages($this->_stateMachine, $action);
-
- // add all the actions
- $uploadNames = $this->get('uploadNames');
- if (!empty($uploadNames)) {
- $config = CRM_Core_Config::singleton();
- $this->addActions($config->customFileUploadDir, $uploadNames);
- }
- else {
- $this->addActions();
- }
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-
-/**
- * This class manages the auction form
- *
- */
-class CRM_Auction_Form_Auction extends CRM_Core_Form {
-
- /**
- * the id of the auction we are processsing
- *
- * @var int
- */
- public $_id;
-
- protected $_dates;
-
- protected $_checkboxes;
-
- protected $_numbers;
-
- /**
- * set variables up before form is built
- *
- * @return void
- */
- function preProcess() {
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
-
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
-
- if (!CRM_Core_Permission::checkActionPermission('CiviAuction', $this->_action)) {
- CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
- }
-
- if (($this->_action & CRM_Core_Action::VIEW ||
- $this->_action & CRM_Core_Action::UPDATE ||
- $this->_action & CRM_Core_Action::DELETE
- ) &&
- !$this->_id
- ) {
- CRM_Core_Error::fatal();
- }
- }
-
- /**
- * Set default values for the form.
- * the default values are retrieved from the database
- * @return array
- */
- function setDefaultValues() {
-
- $defaults = array();
-
- if (isset($this->_id)) {
- $params = array('id' => $this->_id);
- CRM_Auction_BAO_Auction::retrieve($params, $defaults);
- }
- else {
- $defaults['is_active'] = 1;
- }
-
- return $defaults;
- }
-
- /**
- * Build the form object
- *
- * @return array
- */
- public function buildQuickForm() {
- $this->applyFilter('__ALL__', 'trim');
-
- $attributes = CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction');
- $this->add('text',
- 'title',
- ts('Auction Title'),
- $attributes['auction_title'],
- TRUE
- );
-
- $this->addWysiwyg('description',
- ts('Complete Description'),
- $attributes['description']
- );
-
- $this->_dates = array('start_date' => ts('Auction Start Date'),
- 'end_date' => ts('Auction End Date'),
- 'item_start_date' => ts('Upload Item Start Date'),
- 'item_end_date' => ts('Upload Item End Date'),
- );
- foreach ($this->_dates as $name => $title) {
- $this->add('date',
- $name,
- $title,
- CRM_Core_SelectValues::date('datetime')
- );
- $this->addRule($name, ts('Please select a valid date.'), 'qfDate');
- }
-
- $this->_checkboxes = array('is_active' => ts('Is Active?'),
- 'is_approval_needed' => ts('Do items need to be approved?'),
- 'is_item_groups' => ts('Can items be grouped?'),
- );
-
- foreach ($this->_checkboxes as $name => $title) {
- $this->addElement('checkbox',
- $name,
- $title
- );
- }
-
- $this->_numbers = array('max_items_user' => ts('Maximum number of items per user'),
- 'max_items' => ts('Maximum number of items for the auction'),
- );
- foreach ($this->_numbers as $name => $title) {
- $this->addElement('text',
- $name,
- $title,
- $attributes[$name]
- );
- $this->addRule($name,
- ts('%1 should be a postive number',
- array(1 => $title)
- ),
- 'positiveInteger'
- );
- }
-
- if ($this->_action & CRM_Core_Action::VIEW) {
- $buttons = array(array('type' => 'upload',
- 'name' => ts('Done'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ));
- $this->freeze();
- }
- elseif ($this->_action & CRM_Core_Action::DELETE) {
- $this->freeze();
- $buttons = array(array('type' => 'upload',
- 'name' => ts('Delete'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ),
- array('type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- );
- }
- else {
- $buttons = array(array('type' => 'upload',
- 'name' => ts('Save'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ),
- array('type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- );
- }
- $this->addButtons($buttons);
-
- $this->addFormRule(array('CRM_Auction_Form_Auction', 'formRule'), $this);
- }
-
- /**
- * global form rule
- *
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param $self
- * @return true if no errors, else array of errors
- */
- static function formRule($fields, $files, $self) {
- $errors = array();
-
- // add rules to validate dates and overlap
- return empty($errors) ? TRUE : $errors;
- }
-
- /**
- * Process the form submission
- */
- public function postProcess() {
- if ($this->_action & CRM_Core_Action::VIEW) {
- return;
- }
- elseif ($this->_action & CRM_Core_Action::DELETE) {
- CRM_Auction_BAO_Auction::del($this->_id);
- return;
- }
-
- $params = $this->controller->exportValues($this->_name);
-
- $params['id'] = $this->_id;
-
- // format date params
- foreach ($this->_dates as $name => $title) {
- $params[$name] = CRM_Utils_Date::format($params[$name]);
- }
-
- // format checkboxes
- foreach ($this->_checkboxes as $name => $title) {
- $params[$name] = CRM_Utils_Array::value($name, $params, FALSE);
- }
-
- CRM_Auction_BAO_Auction::add($params);
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Form.php';
-
-/**
- * This class manages the auction form
- *
- */
-class CRM_Auction_Form_Item extends CRM_Core_Form {
-
- /**
- * the id of the item we are processing
- *
- * @var int
- */
- public $_id;
-
- /**
- * the id of the auction for this item
- *
- * @var int
- */
- public $_aid;
-
- /**
- * the id of the person donating this item
- *
- * @var int
- */
- public $_donorID;
-
- /**
- * set variables up before form is built
- *
- * @return void
- */
- function preProcess() {
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
-
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
- $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, TRUE);
-
- if (($this->_action & CRM_Core_Action::VIEW ||
- $this->_action & CRM_Core_Action::UPDATE ||
- $this->_action & CRM_Core_Action::DELETE
- ) &&
- !$this->_id
- ) {
- CRM_Core_Error::fatal("I am not sure which item you looking for.");
- }
-
- require_once 'CRM/Auction/BAO/Auction.php';
- $params = array('id' => $this->_aid);
- $this->_auctionValues = array();
- CRM_Auction_BAO_Auction::retrieve($params, $this->_auctionValues);
-
- $this->assign('auctionTitle', $this->_auctionValues['auction_title']);
-
- // set donor id
- $session = CRM_Core_Session::singleton();
- $this->_donorID = $this->get('donorID');
-
- $this->assign('donorName',
- CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
- $this->_donorID,
- 'display_name'
- )
- );
-
- // also set user context
- $session->pushUserContext(CRM_Utils_System::url('civicrm/auction/item',
- "reset=1&aid={$this->_aid}"
- ));
- }
-
- /**
- * Set default values for the form.
- * the default values are retrieved from the database
- * @return array
- */
- function setDefaultValues() {
- $defaults = array();
-
- if (isset($this->_id)) {
- $params = array('id' => $this->_id);
- CRM_Auction_BAO_Item::retrieve($params, $defaults);
- }
- else {
- $defaults['is_active'] = 1;
- $defaults['auction_type_id'] = 1;
- }
-
- return $defaults;
- }
-
- /**
- * Build the form object
- */
- public function buildQuickForm() {
- $this->applyFilter('__ALL__', 'trim');
-
- $attributes = CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Item');
- $this->add('text',
- 'title',
- ts('Item Label'),
- $attributes['title'],
- TRUE
- );
-
- $this->addWysiwyg('description',
- ts('Complete Description'),
- $attributes['description']
- );
-
- $auctionTypes = CRM_Core_OptionGroup::values('auction_item_type');
- $this->add('select', 'auction_item_type_id', ts('Item Type'),
- array('' => ts('- select -')) + $auctionTypes
- );
-
- $this->add('text', 'url', ts('Item URL'),
- array_merge($attributes['description'],
- array('onfocus' => "if (!this.value) { this.value='http://';} else return false",
- 'onblur' => "if ( this.value == 'http://') { this.value='';} else return false",
- )
- )
- );
-
-
- $this->_checkboxes = array('is_active' => ts('Is Active?'),
- 'is_group' => ts('Does this item have other items associated with it?'),
- );
- foreach ($this->_checkboxes as $name => $title) {
- $this->addElement('checkbox',
- $name,
- $title
- );
- }
-
- $this->_numbers = array('quantity' => ts('Number of units available'),
- 'retail_value' => ts('Retail value of item'),
- 'min_bid_value' => ts('Minimum bid accepted'),
- 'min_bid_increment' => ts('Minimum bid increment'),
- 'buy_now_value' => ts('Buy it now value'),
- );
-
- foreach ($this->_numbers as $name => $title) {
- $this->addElement('text',
- $name,
- $title,
- $attributes[$name]
- );
- if ($name == 'quantity') {
- $this->addRule($name,
- ts('%1 should be a postive number',
- array(1 => $title)
- ),
- 'positiveInteger'
- );
- }
- else {
- $this->addRule($name,
- ts('%1 should be a valid money value',
- array(1 => $title)
- ),
- 'money'
- );
- }
- }
-
- $maxAttachments = 1;
- require_once 'CRM/Core/BAO/File.php';
- CRM_Core_BAO_File::buildAttachment($this, 'civicrm_pcp', $this->_pageId, $maxAttachments);
-
-
- if ($this->_action & CRM_Core_Action::VIEW) {
- $buttons = array(array('type' => 'upload',
- 'name' => ts('Done'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ));
- $this->freeze();
- }
- elseif ($this->_action & CRM_Core_Action::DELETE) {
- $this->freeze();
- $buttons = array(array('type' => 'upload',
- 'name' => ts('Delete'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ),
- array('type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- );
- }
- else {
- $buttons = array(array('type' => 'upload',
- 'name' => ts('Save'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- ));
-
- $session = CRM_Core_Session::singleton();
- if ($session->get('userID')) {
- $buttons[] = array('type' => 'next',
- 'name' => ts('Save and New'),
- 'subName' => 'new',
- );
- }
- $buttons[] = array('type' => 'cancel',
- 'name' => ts('Cancel'),
- );
- }
- $this->addButtons($buttons);
-
- $this->addFormRule(array('CRM_Auction_Form_Item', 'formRule'), $this);
- }
-
- /**
- * global form rule
- *
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param $self
- * @return true if no errors, else array of errors
- */
- static function formRule($fields, $files, $self) {
- $errors = array();
-
- if (isset($files['attachFile_1'])) {
- list($width, $height) = getimagesize($files['attachFile_1']['tmp_name']);
- if ($width > 360 || $height > 360) {
- $errors['attachFile_1'] = "Your picture or image file can not be larger than 360 x 360 pixels in size." . " The dimensions of the image you've selected is " . $width . " x " . $height . ". Please shrink or crop the file or find another smaller image and try again.";
- }
- }
-
- return empty($errors) ? TRUE : $errors;
- }
-
- /**
- * Process the form submission
- */
- public function postProcess() {
- if ($this->_action & CRM_Core_Action::VIEW) {
- return;
- }
- elseif ($this->_action & CRM_Core_Action::DELETE) {
- CRM_Auction_BAO_Item::del($this->_id);
- return;
- }
-
- $params = $this->controller->exportValues($this->_name);
-
- $params['id'] = $this->_id;
- $params['auction_id'] = $this->_aid;
-
- $params['donor_id'] = $this->_donorID;
-
- if ($this->_action == CRM_Core_Action::ADD) {
- $params['creator_id'] = $this->_donorID;
- $params['created_date'] = date('YmdHis');
- }
-
- // format checkboxes
- foreach ($this->_checkboxes as $name => $title) {
- $params[$name] = CRM_Utils_Array::value($name, $params, FALSE);
- }
-
- // does this auction require approval
- $params['is_approved'] = $this->_auctionValues['is_approval_needed'] ? 0 : 1;
-
- CRM_Auction_BAO_Item::add($params);
-
- if ($this->controller->getButtonName() == $this->getButtonName('next', 'new')) {
- $session = CRM_Core_Session::singleton();
- //CRM_Core_Session::setStatus(ts(' You can add another profile field.'));
- $session->replaceUserContext(CRM_Utils_System::url('civicrm/auction/item',
- "reset=1&action=add&aid={$this->_aid}"
- ));
- }
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-require_once 'CRM/Core/Form.php';
-
-/**
- * This class generates form components for adding an account if not already exists
- *
- */
-class CRM_Auction_Form_ItemAccount extends CRM_Core_Form {
-
- /**
- * the id of the auction for which item needs to be updated/added.
- *
- * @var int
- */
- public $_aid = NULL;
-
- /**
- * the id of the item we are processing
- *
- * @var int
- */
- public $_id = NULL;
-
- public function preProcess() {
- $session = CRM_Core_Session::singleton();
- $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
- $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
-
- if ($session->get('userID')) {
- $this->_donorID = $session->get('userID');
- }
-
- if (!$this->_aid) {
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
- $this->_aid = CRM_Core_DAO::getFieldValue('CRM_Auction_DAO_Item', $this->_id, 'auction_id');
- }
-
- // we do not want to display recently viewed items, so turn off
- $this->assign('displayRecent', FALSE);
- }
-
- /**
- * This virtual function is used to set the default values of
- * various form elements
- * @return array reference to the array of default values
- */
- function setDefaultValues() {
- if (!$this->_donorID) {
- return;
- }
-
- foreach ($this->_fields as $name => $dontcare) {
- $fields[$name] = 1;
- }
-
- require_once "CRM/Core/BAO/UFGroup.php";
- CRM_Core_BAO_UFGroup::setProfileDefaults($this->_donorID, $fields, $this->_defaults);
-
- //set custom field defaults
- require_once "CRM/Core/BAO/CustomField.php";
- foreach ($this->_fields as $name => $field) {
- if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
- if (!isset($this->_defaults[$name])) {
- CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID, $name, $this->_defaults,
- NULL, CRM_Profile_Form::MODE_REGISTER
- );
- }
- }
- }
-
- return $this->_defaults;
- }
-
- /**
- * Build the form object
- */
- public function buildQuickForm() {
- $profileID = CRM_Core_DAO::getFieldValue('CRM_Auction_DAO_Auction',
- $this->_aid, 'donor_profile_id'
- );
- if (!$profileID) {
- CRM_Core_Error::fatal('Profile not configured for this auction.');
- }
-
- require_once 'CRM/Auction/BAO/Item.php';
- if (CRM_Auction_BAO_Item::isEmailInProfile($profileID)) {
- $this->assign('profileDisplay', TRUE);
- }
-
- $fields = NULL;
- require_once "CRM/Core/BAO/UFGroup.php";
- if ($this->_donorID) {
- if (CRM_Core_BAO_UFGroup::filterUFGroups($profileID, $this->_donorID)) {
- $fields = CRM_Core_BAO_UFGroup::getFields($profileID, FALSE, CRM_Core_Action::ADD);
- }
- $this->addFormRule(array('CRM_Auction_Form_ItemAccount', 'formRule'), $this);
- }
- else {
- require_once 'CRM/Core/BAO/CMSUser.php';
- CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE);
-
- $fields = CRM_Core_BAO_UFGroup::getFields($profileID, FALSE, CRM_Core_Action::ADD);
- }
-
- if ($fields) {
- $this->assign('fields', $fields);
- $addCaptcha = FALSE;
- foreach ($fields as $key => $field) {
- if (isset($field['data_type']) && $field['data_type'] == 'File') {
- // ignore file upload fields
- continue;
- }
- require_once "CRM/Core/BAO/UFGroup.php";
- require_once "CRM/Profile/Form.php";
- CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
- $this->_fields[$key] = $field;
- if ($field['add_captcha']) {
- $addCaptcha = TRUE;
- }
- }
-
- if ($addCaptcha) {
- require_once 'CRM/Utils/ReCAPTCHA.php';
- $captcha = &CRM_Utils_ReCAPTCHA::singleton();
- $captcha->add($this);
- $this->assign("isCaptcha", TRUE);
- }
- }
-
- $button[] = array('type' => 'next',
- 'name' => ts('Continue >>'),
- 'spacing' => ' ',
- 'isDefault' => TRUE,
- );
-
- $this->addButtons($button);
- }
-
- /**
- * global form rule
- *
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param $self
- *
- * @return bool|array
- */
- static function formRule($fields, $files, $self) {
- $errors = array();
- foreach ($fields as $key => $value) {
- if (strpos($key, 'email-') !== FALSE) {
- $ufContactId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFMatch', $value, 'contact_id', 'uf_name');
- if ($ufContactId && $ufContactId != $self->_donorID) {
- $errors[$key] = ts('There is already an user associated with this email address. Please enter different email address.');
- }
- }
- }
- return empty($errors) ? TRUE : $errors;
- }
-
- /**
- * Process the form submission
- */
- public function postProcess() {
- $params = $this->controller->exportValues($this->getName());
- if (!$this->_donorID) {
- foreach ($params as $key => $value) {
- if (substr($key, 0, 5) == 'email' && !empty($value)) {
- $params['email'] = $value;
- }
- }
- }
- $donorID = &CRM_Contact_BAO_Contact::createProfileContact($params, $this->_fields,
- $this->_donorID, $addToGroups
- );
- $this->set('donorID', $donorID);
-
- require_once "CRM/Contribute/BAO/Contribution/Utils.php";
- CRM_Contribute_BAO_Contribution_Utils::createCMSUser($params, $donorID, 'email');
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Form.php';
-require_once 'CRM/Core/OptionGroup.php';
-
-/**
- * Class CRM_Auction_Form_SearchAuction
- */
-class CRM_Auction_Form_SearchAuction extends CRM_Core_Form {
- /**
- * This virtual function is used to set the default values of
- * various form elements
- *
- * access public
- *
- * @return array reference to the array of default values
- *
- */
- function setDefaultValues() {
- $defaults = array();
- $defaults['auctionsByDates'] = 0;
-
- require_once 'CRM/Core/ShowHideBlocks.php';
- $this->_showHide = new CRM_Core_ShowHideBlocks();
- if (empty($defaults['auctionsByDates'])) {
- $this->_showHide->addHide('id_fromToDates');
- }
-
- $this->_showHide->addToTemplate();
- return $defaults;
- }
-
- /**
- * Build the form object
- * @return void
- */
- public function buildQuickForm() {
- $this->add('text', 'title', ts('Find'),
- array(CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction', 'title'))
- );
-
- $auctionsByDates = array();
- $searchOption = array(ts('Show Current and Upcoming Auctions'), ts('Search All or by Date Range'));
- $this->addRadio('auctionsByDates', ts('Auctions by Dates'), $searchOption, array('onclick' => "return showHideByValue('auctionsByDates','1','id_fromToDates','block','radio',true);"), "<br />");
-
- $this->add('date', 'start_date', ts('From'), CRM_Core_SelectValues::date('relative'));
- $this->addRule('start_date', ts('Select a valid Auction FROM date.'), 'qfDate');
-
- $this->add('date', 'end_date', ts('To'), CRM_Core_SelectValues::date('relative'));
- $this->addRule('end_date', ts('Select a valid Auction TO date.'), 'qfDate');
-
- $this->addButtons(array(
- array('type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
- }
-
- function postProcess() {
- $params = $this->controller->exportValues($this->_name);
- $parent = $this->controller->getParent();
- $parent->set('searchResult', 1);
- if (!empty($params)) {
- $fields = array('title', 'event_type_id', 'start_date', 'end_date', 'auctionsByDates');
- foreach ($fields as $field) {
- if (isset($params[$field]) &&
- !CRM_Utils_System::isNull($params[$field])
- ) {
- $parent->set($field, $params[$field]);
- }
- else {
- $parent->set($field, NULL);
- }
- }
- }
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Form.php';
-require_once 'CRM/Core/OptionGroup.php';
-
-/**
- * Class CRM_Auction_Form_SearchItem
- */
-class CRM_Auction_Form_SearchItem extends CRM_Core_Form {
- /**
- * This virtual function is used to set the default values of
- * various form elements
- *
- * @return array reference to the array of default values
- */
- function setDefaultValues() {
- $defaults = array();
- $defaults['auctionsByDates'] = 0;
-
- return $defaults;
- }
-
- /**
- * Build the form object
- * @return void
- */
- public function buildQuickForm() {
- $this->add('text', 'title', ts('Find'),
- array(CRM_Core_DAO::getAttribute('CRM_Auction_DAO_Auction', 'title'))
- );
-
- $this->add('date', 'start_date', ts('From'), CRM_Core_SelectValues::date('relative'));
- $this->addRule('start_date', ts('Select a valid Auction FROM date.'), 'qfDate');
-
- $this->add('date', 'end_date', ts('To'), CRM_Core_SelectValues::date('relative'));
- $this->addRule('end_date', ts('Select a valid Auction TO date.'), 'qfDate');
-
- $this->addButtons(array(
- array('type' => 'refresh',
- 'name' => ts('Search'),
- 'isDefault' => TRUE,
- ),
- ));
- }
-
- /**
- *
- */
- function postProcess() {
- $params = $this->controller->exportValues($this->_name);
- $parent = $this->controller->getParent();
- $parent->set('searchResult', 1);
- if (!empty($params)) {
- $fields = array('title', 'item_type_id');
- foreach ($fields as $field) {
- if (isset($params[$field]) &&
- !CRM_Utils_System::isNull($params[$field])
- ) {
- $parent->set($field, $params[$field]);
- }
- else {
- $parent->set($field, NULL);
- }
- }
- }
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-
-
-require_once 'CRM/Core/Component/Info.php';
-
-/**
- * This class introduces component to the system and provides all the
- * information about it. It needs to extend CRM_Core_Component_Info
- * abstract class.
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- */
-class CRM_Auction_Info extends CRM_Core_Component_Info {
-
- protected $keyword = 'auction';
-
- /**
- * Provides base information about the component.
- * Needs to be implemented in component's information
- * class.
- *
- * @return array collection of required component settings
- */
- public function getInfo() {
- return array('name' => 'CiviAuction',
- 'translatedName' => ts('CiviAuction'),
- 'title' => ts('CiviCRM Auctions'),
- 'search' => 0,
- 'showActivitiesInCore' => 0,
- );
- }
-
-
- // docs inherited from interface
- /**
- * @return array
- */
- public function getPermissions() {
- return array('access CiviAuction',
- 'add auction items',
- 'approve auction items',
- 'bid on auction items',
- 'delete in CiviAuction',
- );
- }
-
- /**
- * Provides information about user dashboard element
- * offered by this component.
- *
- * @return array collection of required dashboard settings,
- * null if no element offered
- */
- public function getUserDashboardElement() {
- return array('name' => ts('Auctions'),
- 'title' => ts('Your Winning Auction Item(s)'),
- 'perm' => array('bid on auction items'),
- 'weight' => 20,
- );
- }
-
- /**
- * Provides information about user dashboard element
- * offered by this component.
- *
- * @return array|null collection of required dashboard settings,
- * null if no element offered
- */
- public function registerTab() {
- return array('title' => ts('Auctions'),
- 'id' => 'auction',
- 'url' => 'auction',
- 'weight' => 40,
- );
- }
-
- /**
- * Provides information about advanced search pane
- * offered by this component.
- *
- * @return array collection of required pane settings,
- * null if no element offered
- */
- public function registerAdvancedSearchPane() {
- return array('title' => ts('Auctions'),
- 'weight' => 40,
- );
- }
-
- /**
- * Provides potential activity types that this
- * component might want to register in activity history.
- * Needs to be implemented in component's information
- * class.
- *
- * @return array|null collection of activity types
- */
- public function getActivityTypes() {
- $types = array();
- return $types;
- }
-
- /**
- * @param $shortCuts
- */
- public function creatNewShortcut(&$shortCuts) {}
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Page to decide the flow of adding an item.
- */
-class CRM_Auction_Page_AddItem extends CRM_Core_Page {
-
- /**
- * Run the page.
- *
- * This method is called after the page is created. It checks for the
- * type of action and executes that action.
- * Finally it calls the parent's run method.
- *
- * @return void
- */
- function run() {
- // get the requested action
- $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
-
- // set breadcrumb to append to 2nd layer pages
- $breadCrumb = array(array('title' => ts('Manage Items'),
- 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'reset=1'
- ),
- ));
- // what action to take ?
- if ($action & CRM_Core_Action::ADD) {
- $session = CRM_Core_Session::singleton();
- if ($session->get('userID')) {
- // For logged in user directly go to add/update item page.
- $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item',
- 'New Item',
- $action
- );
- $controller->set('donorID', $session->get('userID'));
- }
- else {
- // For anonymous user go via account creation wizard.
- require_once 'CRM/Auction/Controller/Item.php';
- $controller = new CRM_Auction_Controller_Item('New Item', $action);
- }
- return $controller->run();
- }
- elseif ($action & CRM_Core_Action::UPDATE) {
- $session = CRM_Core_Session::singleton();
- if ($session->get('userID')) {
- $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item',
- 'Update Item',
- $action
- );
- $controller->set('donorID', $session->get('userID'));
- return $controller->run();
- }
- }
-
- parent::run();
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Page.php';
-
-/**
- * Page for displaying list of auctions
- */
-class CRM_Auction_Page_DashBoard extends CRM_Core_Page {
-
- /**
- * This function is the main function that is called when the page loads,
- * it decides the which action has to be taken for the page.
- *
- * return null
- */
- function run() {
- parent::run();
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Page.php';
-
-/**
- * Page for displaying list of auctions
- */
-class CRM_Auction_Page_Item extends CRM_Core_Page {
-
- /**
- * the id of the auction for this item
- *
- * @var int
- */
- public $_aid;
-
- protected $_pager = NULL;
-
- protected $_sortByCharacter;
-
- /**
- * Run the page.
- *
- * This method is called after the page is created. It checks for the
- * type of action and executes that action.
- * Finally it calls the parent's run method.
- *
- * @return void
- */
- function run() {
- // get the requested action
- $action = CRM_Utils_Request::retrieve('action', 'String',
- // default to 'browse'
- $this, FALSE, 'browse'
- );
-
- // assign vars to templates
- $this->assign('action', $action);
- $id = CRM_Utils_Request::retrieve('id', 'Positive',
- $this, FALSE, 0
- );
-
- $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
-
- // set breadcrumb to append to 2nd layer pages
- $breadCrumb = array(array('title' => ts('Manage Items'),
- 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'reset=1'
- ),
- ));
-
- // what action to take ?
- if ($action & CRM_Core_Action::DISABLE) {
- require_once 'CRM/Auction/BAO/Auction.php';
- CRM_Auction_BAO_Auction::setIsActive($id, 0);
- }
- elseif ($action & CRM_Core_Action::ENABLE) {
- require_once 'CRM/Auction/BAO/Auction.php';
- CRM_Auction_BAO_Auction::setIsActive($id, 1);
- }
- elseif ($action & CRM_Core_Action::DELETE) {
- $session = CRM_Core_Session::singleton();
- $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
- $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Auction_Delete',
- 'Delete Auction',
- $action
- );
- $id = CRM_Utils_Request::retrieve('id', 'Positive',
- $this, FALSE, 0
- );
- $controller->set('id', $id);
- $controller->process();
- return $controller->run();
- }
-
- // finally browse the auctions
- $this->browse();
-
- // parent run
- parent::run();
- }
-
- /**
- * Browse all auctions
- *
- * @return void
- */
- function browse() {
- if ($this->_aid) {
- $this->assign('manageItemURL', CRM_Utils_System::url('civicrm/auction/item/manage',
- 'reset=1&aid=' . $this->_aid
- ));
- }
-
- $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
- 'String',
- $this
- );
- if ($this->_sortByCharacter == 1 ||
- !empty($_POST)
- ) {
- $this->_sortByCharacter = '';
- $this->set('sortByCharacter', '');
- }
-
- $this->_force = NULL;
- $this->_searchResult = NULL;
-
- $this->search();
-
- $config = CRM_Core_Config::singleton();
-
- $params = array();
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean',
- $this, FALSE
- );
- $this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
-
- $whereClause = $this->whereClause($params, FALSE, $this->_force);
- $this->pagerAToZ($whereClause, $params);
-
- $params = array();
- $whereClause = $this->whereClause($params, TRUE, $this->_force);
- $this->pager($whereClause, $params);
- list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
-
- if ($this->_aid) {
- $whereClause .= " AND auction_id = {$this->_aid}";
- }
-
- $query = "
- SELECT i.*, c.display_name as donorName, max(b.bid_value) as maxBid
- FROM civicrm_auction_item i
- INNER JOIN civicrm_contact c ON i.donor_id = c.id
- LEFT JOIN civicrm_auction_bid b ON i.id = b.auction_item_id
- WHERE $whereClause
- GROUP BY i.id
- LIMIT $offset, $rowCount";
-
- $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Auction_DAO_Item');
-
- // get all custom groups sorted by weight
- $items = array();
- $auctionItemTypes = CRM_Core_OptionGroup::values('auction_item_type');
- while ($dao->fetch()) {
- $items[$dao->id] = array();
- CRM_Core_DAO::storeValues($dao, $items[$dao->id]);
-
- $items[$dao->id]['donorName'] = $dao->donorName;
- $items[$dao->id]['auction_item_type'] = CRM_Utils_Array::value($dao->auction_type_id, $auctionItemTypes);
- $items[$dao->id]['max_bid'] = $dao->maxBid;
- }
- $this->assign('rows', $items);
- }
-
- function search() {
- $form = new CRM_Core_Controller_Simple('CRM_Auction_Form_SearchAuction', ts('Search Auctions'), CRM_Core_Action::ADD);
- $form->setEmbedded(TRUE);
- $form->setParent($this);
- $form->process();
- $form->run();
- }
-
- /**
- * @param array $params
- * @param bool $sortBy
- * @param $force
- *
- * @return int|string
- */
- function whereClause(&$params, $sortBy = TRUE, $force) {
- $values = array();
- $clauses = array();
- $title = $this->get('title');
- if ($title) {
- $clauses[] = "title LIKE %1";
- if (strpos($title, '%') !== FALSE) {
- $params[1] = array(trim($title), 'String', FALSE);
- }
- else {
- $params[1] = array(trim($title), 'String', TRUE);
- }
- }
-
- if ($sortBy &&
- $this->_sortByCharacter
- ) {
- $clauses[] = 'title LIKE %6';
- $params[6] = array($this->_sortByCharacter . '%', 'String');
- }
-
- // dont do a the below assignment when doing a
- // AtoZ pager clause
- if ($sortBy) {
- if (count($clauses) > 1) {
- $this->assign('isSearch', 1);
- }
- else {
- $this->assign('isSearch', 0);
- }
- }
-
- if (empty($clauses)) {
- return 1;
- }
-
- return implode(' AND ', $clauses);
- }
-
- /**
- * @param $whereClause
- * @param $whereParams
- */
- function pager($whereClause, $whereParams) {
- require_once 'CRM/Utils/Pager.php';
-
- $params['status'] = ts('Item %%StatusMessage%%');
- $params['csvString'] = NULL;
- $params['buttonTop'] = 'PagerTopButton';
- $params['buttonBottom'] = 'PagerBottomButton';
- $params['rowCount'] = $this->get(CRM_Utils_Pager::PAGE_ROWCOUNT);
- if (!$params['rowCount']) {
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
- }
-
- $query = "
-SELECT count(id)
- FROM civicrm_auction_item
- WHERE $whereClause";
-
- $params['total'] = CRM_Core_DAO::singleValueQuery($query, $whereParams);
-
- $this->_pager = new CRM_Utils_Pager($params);
- $this->assign_by_ref('pager', $this->_pager);
- }
-
- /**
- * @param $whereClause
- * @param $whereParams
- */
- function pagerAtoZ($whereClause, $whereParams) {
- require_once 'CRM/Utils/PagerAToZ.php';
-
- $query = "
- SELECT DISTINCT UPPER(LEFT(title, 1)) as sort_name
- FROM civicrm_auction_item
- WHERE $whereClause
- ORDER BY LEFT(title, 1)
-";
- $dao = CRM_Core_DAO::executeQuery($query, $whereParams);
-
- $aToZBar = CRM_Utils_PagerAToZ::getAToZBar($dao, $this->_sortByCharacter, TRUE);
- $this->assign('aToZ', $aToZBar);
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Page for displaying list of auctions
- */
-class CRM_Auction_Page_Manage extends CRM_Core_Page {
-
- /**
- * The action links that we need to display for the browse screen
- *
- * @var array
- */
- static $_actionLinks = NULL;
-
- static $_links = NULL;
-
- protected $_pager = NULL;
-
- protected $_sortByCharacter;
-
- /**
- * Get action Links
- *
- * @return array (reference) of action links
- */
- function &links() {
- if (!(self::$_actionLinks)) {
- // helper variable for nicer formatting
- $disableExtra = ts('Are you sure you want to disable this Auction?');
- $deleteExtra = ts('Are you sure you want to delete this Auction?');
- $copyExtra = ts('Are you sure you want to make a copy of this Auction?');
-
- self::$_actionLinks = array(
- CRM_Core_Action::UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/auction/add',
- 'qs' => 'action=update&id=%%id%%&reset=1',
- 'title' => ts('Edit Auction'),
- ),
- CRM_Core_Action::PREVIEW => array(
- 'name' => ts('Items'),
- 'url' => 'civicrm/auction/item/manage',
- 'qs' => 'aid=%%id%%&reset=1',
- 'title' => ts('Manage Items'),
- ),
- CRM_Core_Action::DISABLE => array(
- 'name' => ts('Disable'),
- 'url' => CRM_Utils_System::currentPath(),
- 'qs' => 'action=disable&id=%%id%%',
- 'extra' => 'onclick = "return confirm(\'' . $disableExtra . '\');"',
- 'title' => ts('Disable Auction'),
- ),
- CRM_Core_Action::ENABLE => array(
- 'name' => ts('Enable'),
- 'url' => CRM_Utils_System::currentPath(),
- 'qs' => 'action=enable&id=%%id%%',
- 'title' => ts('Enable Auction'),
- ),
- CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
- 'url' => 'civicrm/auction/item/add',
- 'qs' => 'action=delete&id=%%id%%&reset=1',
- 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"',
- 'title' => ts('Delete Auction'),
- ),
- CRM_Core_Action::COPY => array(
- 'name' => ts('Copy Auction'),
- 'url' => CRM_Utils_System::currentPath(),
- 'qs' => 'reset=1&action=copy&id=%%id%%',
- 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"',
- 'title' => ts('Copy Auction'),
- ),
- );
- }
- return self::$_actionLinks;
- }
-
- /**
- * Run the page.
- *
- * This method is called after the page is created. It checks for the
- * type of action and executes that action.
- * Finally it calls the parent's run method.
- *
- * @return void
- */
- function run() {
- // get the requested action
- $action = CRM_Utils_Request::retrieve('action', 'String',
- // default to 'browse'
- $this, FALSE, 'browse'
- );
-
- // assign vars to templates
- $this->assign('action', $action);
- $id = CRM_Utils_Request::retrieve('id', 'Positive',
- $this, FALSE, 0
- );
-
- // set breadcrumb to append to 2nd layer pages
- $breadCrumb = array(array('title' => ts('Manage Items'),
- 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'reset=1'
- ),
- ));
-
- // what action to take ?
- if ($action & CRM_Core_Action::DISABLE) {
- require_once 'CRM/Auction/BAO/Item.php';
- CRM_Auction_BAO_Item::setIsActive($id, 0);
- }
- elseif ($action & CRM_Core_Action::ENABLE) {
- require_once 'CRM/Auction/BAO/Item.php';
- CRM_Auction_BAO_Item::setIsActive($id, 1);
- }
- elseif ($action & CRM_Core_Action::DELETE) {
- $session = CRM_Core_Session::singleton();
- $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
- $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Item_Delete',
- 'Delete Item',
- $action
- );
- $id = CRM_Utils_Request::retrieve('id', 'Positive',
- $this, FALSE, 0
- );
- $controller->set('id', $id);
- $controller->process();
- return $controller->run();
- }
- elseif ($action & CRM_Core_Action::COPY) {
- $this->copy();
- }
-
- // finally browse the auctions
- $this->browse();
-
- // parent run
- parent::run();
- }
-
- /**
- * Browse all auctions
- *
- * @return void
- */
- function browse() {
-
- $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
- 'String',
- $this
- );
- if ($this->_sortByCharacter == 1 ||
- !empty($_POST)
- ) {
- $this->_sortByCharacter = '';
- $this->set('sortByCharacter', '');
- }
-
- $this->_force = NULL;
- $this->_searchResult = NULL;
-
- $this->search();
-
- $config = CRM_Core_Config::singleton();
-
- $params = array();
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean',
- $this, FALSE
- );
- $this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
-
- $whereClause = $this->whereClause($params, FALSE, $this->_force);
- $this->pagerAToZ($whereClause, $params);
-
- $params = array();
- $whereClause = $this->whereClause($params, TRUE, $this->_force);
- $this->pager($whereClause, $params);
- list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
-
- // get all custom groups sorted by weight
- $auctions = array();
-
- $query = "
- SELECT *
- FROM civicrm_auction
- WHERE $whereClause
-ORDER BY start_date desc
- LIMIT $offset, $rowCount";
-
- $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Auction_DAO_Item');
-
- while ($dao->fetch()) {
- $auctions[$dao->id] = array();
- CRM_Core_DAO::storeValues($dao, $auctions[$dao->id]);
-
- // form all action links
- $action = array_sum(array_keys($this->links()));
-
- if ($dao->is_active) {
- $action -= CRM_Core_Action::ENABLE;
- }
- else {
- $action -= CRM_Core_Action::DISABLE;
- }
-
- $auctions[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(), $action,
- array('id' => $dao->id)
- );
- }
- $this->assign('rows', $auctions);
- }
-
- /**
- *
- */
- function search() {
- $form = new CRM_Core_Controller_Simple('CRM_Auction_Form_SearchAuction',
- ts('Search Items'), CRM_Core_Action::ADD
- );
- $form->setEmbedded(TRUE);
- $form->setParent($this);
- $form->process();
- $form->run();
- }
-
- /**
- * @param array $params
- * @param bool $sortBy
- * @param $force
- *
- * @return int|string
- */
- function whereClause(&$params, $sortBy = TRUE, $force) {
- $values = array();
- $clauses = array();
- $title = $this->get('title');
- if ($title) {
- $clauses[] = "title LIKE %1";
- if (strpos($title, '%') !== FALSE) {
- $params[1] = array(trim($title), 'String', FALSE);
- }
- else {
- $params[1] = array(trim($title), 'String', TRUE);
- }
- }
-
- if ($sortBy &&
- $this->_sortByCharacter
- ) {
- $clauses[] = 'title LIKE %6';
- $params[6] = array($this->_sortByCharacter . '%', 'String');
- }
-
- // dont do a the below assignment when doing a
- // AtoZ pager clause
- if ($sortBy) {
- if (count($clauses) > 1 || $auctionByDates) {
- $this->assign('isSearch', 1);
- }
- else {
- $this->assign('isSearch', 0);
- }
- }
-
- if (empty($clauses)) {
- return 1;
- }
-
- return implode(' AND ', $clauses);
- }
-
- /**
- * @param $whereClause
- * @param $whereParams
- */
- function pager($whereClause, $whereParams) {
- require_once 'CRM/Utils/Pager.php';
-
- $params['status'] = ts('Item %%StatusMessage%%');
- $params['csvString'] = NULL;
- $params['buttonTop'] = 'PagerTopButton';
- $params['buttonBottom'] = 'PagerBottomButton';
- $params['rowCount'] = $this->get(CRM_Utils_Pager::PAGE_ROWCOUNT);
- if (!$params['rowCount']) {
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
- }
-
- $query = "
-SELECT count(id)
- FROM civicrm_auction
- WHERE $whereClause";
-
- $params['total'] = CRM_Core_DAO::singleValueQuery($query, $whereParams);
-
- $this->_pager = new CRM_Utils_Pager($params);
- $this->assign_by_ref('pager', $this->_pager);
- }
-
- /**
- * @param $whereClause
- * @param $whereParams
- */
- function pagerAtoZ($whereClause, $whereParams) {
- require_once 'CRM/Utils/PagerAToZ.php';
-
- $query = "
- SELECT DISTINCT UPPER(LEFT(title, 1)) as sort_name
- FROM civicrm_auction
- WHERE $whereClause
- ORDER BY LEFT(title, 1)
-";
- $dao = CRM_Core_DAO::executeQuery($query, $whereParams);
-
- $aToZBar = CRM_Utils_PagerAToZ::getAToZBar($dao, $this->_sortByCharacter, TRUE);
- $this->assign('aToZ', $aToZBar);
- }
-}
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- */
-
-
-/**
- * Page for displaying list of auctions
- */
-class CRM_Auction_Page_ManageItem extends CRM_Core_Page {
-
- /**
- * the id of the auction for this item
- *
- * @var int
- */
- public $_aid;
-
- /**
- * The action links that we need to display for the browse screen
- *
- * @var array
- */
- static $_actionLinks = NULL;
-
- static $_links = NULL;
-
- protected $_pager = NULL;
-
- protected $_sortByCharacter;
-
- /**
- * Get action Links
- *
- * @return array (reference) of action links
- */
- function &links() {
- if (!(self::$_actionLinks)) {
- // helper variable for nicer formatting
- $disableExtra = ts('Are you sure you want to disable this Item?');
- $deleteExtra = ts('Are you sure you want to delete this Item?');
- $copyExtra = ts('Are you sure you want to make a copy of this Item?');
-
- self::$_actionLinks = array(
- CRM_Core_Action::UPDATE => array(
- 'name' => ts('Edit'),
- 'url' => 'civicrm/auction/item/add',
- 'qs' => 'action=update&id=%%id%%&aid=%%aid%%&reset=1',
- 'title' => ts('Edit Item'),
- ),
- CRM_Core_Action::DISABLE => array(
- 'name' => ts('Reject'),
- 'url' => CRM_Utils_System::currentPath(),
- 'qs' => 'action=disable&id=%%id%%&aid=%%aid%%',
- 'extra' => 'onclick = "return confirm(\'' . $disableExtra . '\');"',
- 'title' => ts('Disable Item'),
- ),
- CRM_Core_Action::ENABLE => array(
- 'name' => ts('Approve'),
- 'url' => CRM_Utils_System::currentPath(),
- 'qs' => 'action=enable&id=%%id%%&aid=%%aid%%',
- 'title' => ts('Enable Item'),
- ),
- CRM_Core_Action::DELETE => array(
- 'name' => ts('Delete'),
- 'url' => 'civicrm/auction/item/add',
- 'qs' => 'action=delete&id=%%id%%&aid=%%aid%%&reset=1',
- 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"',
- 'title' => ts('Delete Item'),
- ),
- );
- }
- return self::$_actionLinks;
- }
-
- /**
- * Run the page.
- *
- * This method is called after the page is created. It checks for the
- * type of action and executes that action.
- * Finally it calls the parent's run method.
- *
- * @return void
- */
- function run() {
- // get the requested action
- $action = CRM_Utils_Request::retrieve('action', 'String',
- // default to 'browse'
- $this, FALSE, 'browse'
- );
-
- // assign vars to templates
- $this->assign('action', $action);
- $id = CRM_Utils_Request::retrieve('id', 'Positive',
- $this, FALSE, 0
- );
-
- $this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this, TRUE);
-
- // set breadcrumb to append to 2nd layer pages
- $breadCrumb = array(array('title' => ts('Manage Items'),
- 'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
- 'reset=1'
- ),
- ));
-
- // what action to take ?
- if ($action & CRM_Core_Action::DISABLE) {
- require_once 'CRM/Auction/BAO/Item.php';
- CRM_Auction_BAO_Item::setIsActive($id, 0);
- }
- elseif ($action & CRM_Core_Action::ENABLE) {
- require_once 'CRM/Auction/BAO/Item.php';
- CRM_Auction_BAO_Item::setIsActive($id, 1);
- }
- elseif ($action & CRM_Core_Action::DELETE) {
- $session = CRM_Core_Session::singleton();
- $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=browse'));
- $controller = new CRM_Core_Controller_Simple('CRM_Auction_Form_Auction_Delete',
- 'Delete Auction',
- $action
- );
- $id = CRM_Utils_Request::retrieve('id', 'Positive',
- $this, FALSE, 0
- );
- $controller->set('id', $id);
- $controller->process();
- return $controller->run();
- }
- elseif ($action & CRM_Core_Action::COPY) {
- $this->copy();
- }
-
- // finally browse the auctions
- $this->browse();
-
- // parent run
- parent::run();
- }
-
- /**
- * Browse all auctions
- *
- * @return void
- */
- function browse() {
- $this->assign('newItemURL', CRM_Utils_System::url('civicrm/auction/item/add',
- 'reset=1&action=add&aid=' . $this->_aid
- ));
- $this->assign('previewItemURL', CRM_Utils_System::url('civicrm/auction/item',
- 'reset=1&aid=' . $this->_aid
- ));
-
- $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
- 'String',
- $this
- );
- if ($this->_sortByCharacter == 1 ||
- !empty($_POST)
- ) {
- $this->_sortByCharacter = '';
- $this->set('sortByCharacter', '');
- }
-
- $this->_force = NULL;
- $this->_searchResult = NULL;
-
- $this->search();
-
- $config = CRM_Core_Config::singleton();
-
- $params = array();
- $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean',
- $this, FALSE
- );
- $this->_searchResult = CRM_Utils_Request::retrieve('searchResult', 'Boolean', $this);
-
- $whereClause = $this->whereClause($params, FALSE, $this->_force);
- $this->pagerAToZ($whereClause, $params);
-
- $params = array();
- $whereClause = $this->whereClause($params, TRUE, $this->_force);
- $this->pager($whereClause, $params);
- list($offset, $rowCount) = $this->_pager->getOffsetAndRowCount();
-
- //check for delete CRM-4418
- require_once 'CRM/Core/Permission.php';
- $allowToDelete = CRM_Core_Permission::check('delete in CiviAuction');
-
- $query = "
- SELECT i.*, c.display_name as donorName
- FROM civicrm_auction_item i,
- civicrm_contact c
- WHERE $whereClause
- AND auction_id = {$this->_aid}
- AND i.donor_id = c.id
- LIMIT $offset, $rowCount";
-
- $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Auction_DAO_Item');
-
- // get all custom groups sorted by weight
- $items = array();
- $auctionItemTypes = CRM_Core_OptionGroup::values('auction_item_type');
- while ($dao->fetch()) {
- $items[$dao->id] = array();
- CRM_Core_DAO::storeValues($dao, $items[$dao->id]);
-
- $items[$dao->id]['donorName'] = $dao->donorName;
- $items[$dao->id]['auction_item_type'] = CRM_Utils_Array::value($dao->auction_type_id, $auctionItemTypes);
-
- // form all action links
- $action = array_sum(array_keys($this->links()));
-
- if ($dao->is_active) {
- $action -= CRM_Core_Action::ENABLE;
- }
- else {
- $action -= CRM_Core_Action::DISABLE;
- }
- //check for delete
- if (!$allowToDelete) {
- $action -= CRM_Core_Action::DELETE;
- }
-
- $items[$dao->id]['action'] = CRM_Core_Action::formLink(self::links(),
- $action,
- array('id' => $dao->id,
- 'aid' => $this->_aid,
- )
- );
- }
- $this->assign('rows', $items);
- }
-
- /**
- * This function is to make a copy of a Auction, including
- * all the fields in the event wizard
- *
- * @return void
- */
- function copy() {
- $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE, 0, 'GET');
-
- require_once 'CRM/Auction/BAO/Auction.php';
- CRM_Auction_BAO_Auction::copy($id);
-
- return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/manage', 'reset=1'));
- }
-
- function search() {
- $form = new CRM_Core_Controller_Simple('CRM_Auction_Form_SearchAuction', ts('Search Auctions'), CRM_Core_Action::ADD);
- $form->setEmbedded(TRUE);
- $form->setParent($this);
- $form->process();
- $form->run();
- }
-
- /**
- * @param array $params
- * @param bool $sortBy
- * @param $force
- *
- * @return int|string
- */
- function whereClause(&$params, $sortBy = TRUE, $force) {
- $values = array();
- $clauses = array();
- $title = $this->get('title');
- if ($title) {
- $clauses[] = "title LIKE %1";
- if (strpos($title, '%') !== FALSE) {
- $params[1] = array(trim($title), 'String', FALSE);
- }
- else {
- $params[1] = array(trim($title), 'String', TRUE);
- }
- }
-
- if ($sortBy &&
- $this->_sortByCharacter
- ) {
- $clauses[] = 'title LIKE %6';
- $params[6] = array($this->_sortByCharacter . '%', 'String');
- }
-
- // dont do a the below assignment when doing a
- // AtoZ pager clause
- if ($sortBy) {
- if (count($clauses) > 1) {
- $this->assign('isSearch', 1);
- }
- else {
- $this->assign('isSearch', 0);
- }
- }
-
- if (empty($clauses)) {
- return 1;
- }
-
- return implode(' AND ', $clauses);
- }
-
- /**
- * @param $whereClause
- * @param $whereParams
- */
- function pager($whereClause, $whereParams) {
- require_once 'CRM/Utils/Pager.php';
-
- $params['status'] = ts('Item %%StatusMessage%%');
- $params['csvString'] = NULL;
- $params['buttonTop'] = 'PagerTopButton';
- $params['buttonBottom'] = 'PagerBottomButton';
- $params['rowCount'] = $this->get(CRM_Utils_Pager::PAGE_ROWCOUNT);
- if (!$params['rowCount']) {
- $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
- }
-
- $query = "
-SELECT count(id)
- FROM civicrm_auction_item
- WHERE $whereClause";
-
- $params['total'] = CRM_Core_DAO::singleValueQuery($query, $whereParams);
-
- $this->_pager = new CRM_Utils_Pager($params);
- $this->assign_by_ref('pager', $this->_pager);
- }
-
- /**
- * @param $whereClause
- * @param $whereParams
- */
- function pagerAtoZ($whereClause, $whereParams) {
- require_once 'CRM/Utils/PagerAToZ.php';
-
- $query = "
- SELECT DISTINCT UPPER(LEFT(title, 1)) as sort_name
- FROM civicrm_auction_item
- WHERE $whereClause
- ORDER BY LEFT(title, 1)
-";
- $dao = CRM_Core_DAO::executeQuery($query, $whereParams);
-
- $aToZBar = CRM_Utils_PagerAToZ::getAToZBar($dao, $this->_sortByCharacter, TRUE);
- $this->assign('aToZ', $aToZBar);
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/StateMachine.php';
-
-/**
- * State machine for managing different states of Auction Item create process.
- *
- */
-class CRM_Auction_StateMachine_Item extends CRM_Core_StateMachine {
-
- /**
- * class constructor
- *
- * @param object $controller
- * @param \const|int $action
- *
- * @internal param \CRM_Auction_Controller $object
- * @return \CRM_Auction_StateMachine_Item CRM_Contact_Import_StateMachine
- */
- function __construct($controller, $action = CRM_Core_Action::NONE) {
- parent::__construct($controller, $action);
-
- $session = CRM_Core_Session::singleton();
- $session->set('singleForm', FALSE);
-
- $this->_pages = array(
- 'CRM_Auction_Form_ItemAccount' => NULL,
- 'CRM_Auction_Form_Item' => NULL,
- );
-
- $this->addSequentialPages($this->_pages, $action);
- }
-}
-
+++ /dev/null
-<?xml version="1.0" encoding="iso-8859-1" ?>
-
-<menu>
- <item>
- <path>civicrm/auction</path>
- <title>CiviAuction</title>
- <page_callback>CRM_Auction_Page_DashBoard</page_callback>
- <access_arguments>access CiviAuction</access_arguments>
- <page_type>1</page_type>
- <weight>1000</weight>
- <component>CiviAuction</component>
- </item>
- <item>
- <path>civicrm/auction/info</path>
- <page_callback>CRM_Auction_Page_AuctionInfo</page_callback>
- <title>Auction Information</title>
- <access_callback>1</access_callback>
- <is_public>true</is_public>
- </item>
- <item>
- <path>civicrm/auction/item</path>
- <title>Item Listing</title>
- <page_callback>CRM_Auction_Page_Item</page_callback>
- <access_callback>1</access_callback>
- <is_public>true</is_public>
- <is_ssl>true</is_ssl>
- </item>
- <item>
- <path>civicrm/auction/item/manage</path>
- <title>Auction Item</title>
- <page_callback>CRM_Auction_Page_ManageItem</page_callback>
- <access_callback>1</access_callback>
- <is_public>true</is_public>
- <is_ssl>true</is_ssl>
- </item>
- <item>
- <path>civicrm/auction/item/add</path>
- <title>Auction Item</title>
- <page_callback>CRM_Auction_Page_AddItem</page_callback>
- <access_callback>1</access_callback>
- <is_public>true</is_public>
- <is_ssl>true</is_ssl>
- </item>
- <item>
- <path>civicrm/admin/auction</path>
- <title>Manage Auctions</title>
- <page_callback>CRM_Auction_Page_Manage</page_callback>
- <desc>Create and edit auction configuration including times.</desc>
- <access_arguments>access CiviAuction</access_arguments>
- <adminGroup>CiviAuction</adminGroup>
- <icon>admin/small/auction_manage.png</icon>
- <weight>370</weight>
- </item>
- <item>
- <path>civicrm/admin/auction/add</path>
- <title>Add Auctions</title>
- <page_callback>CRM_Auction_Form_Auction</page_callback>
- <desc>Create and edit auction configuration including times.</desc>
- <access_arguments>access CiviAuction</access_arguments>
- <adminGroup>CiviAuction</adminGroup>
- <icon>admin/small/auction_manage.png</icon>
- <weight>370</weight>
- </item>
- <item>
- <path>civicrm/admin/options/auction_type</path>
- <title>Auction Types</title>
- <page_callback>CRM_Admin_Page_Options</page_callback>
- <desc>Use Auction Types to categorize your auction items.</desc>
- <access_arguments>administer CiviCRM,access CiviAuction</access_arguments>
- <adminGroup>CiviAuction</adminGroup>
- <icon>admin/small/auction_type.png</icon>
- <weight>375</weight>
- </item>
- <item>
- <path>civicrm/auction/search</path>
- <title>Find Auction Items</title>
- <page_callback>CRM_Auction_Controller_Search</page_callback>
- <access_arguments>access CiviAuction</access_arguments>
- <page_type>1</page_type>
- <weight>1010</weight>
- </item>
- <item>
- <path>civicrm/auction/manage</path>
- <title>Manage Auctions</title>
- <page_callback>CRM_Auction_Page_Manage</page_callback>
- <access_arguments>access CiviAuction</access_arguments>
- <page_type>1</page_type>
- <weight>1020</weight>
- </item>
- <item>
- <path>civicrm/auction/add</path>
- <path_arguments>action=add</path_arguments>
- <title>New Auction</title>
- <page_callback>CRM_Auction_Form_Auction</page_callback>
- <access_arguments>access CiviAuction</access_arguments>
- <page_type>1</page_type>
- <weight>1030</weight>
- </item>
-</menu>
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * Config handles all the run time configuration changes that the system needs to deal with.
- * Typically we'll have different values for a user's sandbox, a qa sandbox and a production area.
- * The default values in general, should reflect production values (minimizes chances of screwing up)
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-require_once 'CRM/Core/Component/Config.php';
-
-/**
- * Class CRM_Touchstone_Config
- */
-class CRM_Touchstone_Config extends CRM_Core_Component_Config {}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-
-
-require_once 'CRM/Core/Component/Info.php';
-
-/**
- * This class introduces component to the system and provides all the
- * information about it. It needs to extend CRM_Core_Component_Info
- * abstract class.
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- */
-class CRM_Touchstone_Info extends CRM_Core_Component_Info {
-
- protected $keyword = 'touchstone';
-
- /**
- * Provides base information about the component.
- * Needs to be implemented in component's information
- * class.
- *
- * @return array collection of required component settings
- */
- public function getInfo() {
- return array('name' => 'CiviTouchstone',
- 'translatedName' => ts('CiviTouchstone'),
- 'title' => ts('CiviCRM Touchstone Component'),
- 'search' => 1,
- );
- }
-
- /**
- * @return array
- */
- public function getPermissions() {
- return array('access CiviTouchstone');
- }
-
- /**
- * Provides information about user dashboard element
- * offered by this component.
- *
- * @return array|null collection of required dashboard settings,
- * null if no element offered
- */
- public function getUserDashboardElement() {
- return array('name' => ts('Touchstone'),
- 'title' => ts('Your Touchstone'),
- 'perm' => array('access CiviTouchstone'),
- 'weight' => 85,
- );
- }
-
- /**
- * Provides information about user dashboard element
- * offered by this component.
- *
- * @return array|null collection of required dashboard settings,
- * null if no element offered
- */
- public function registerTab() {
- return array('title' => ts('Touchstone'),
- 'url' => 'touchstone',
- 'weight' => 25,
- );
- }
-
- /**
- * Provides information about advanced search pane
- * offered by this component.
- *
- * @return array|null collection of required pane settings,
- * null if no element offered
- */
- public function registerAdvancedSearchPane() {
- return array('title' => ts('Touchstone'),
- 'weight' => 25,
- );
- }
-
- /**
- * Provides potential activity types that this
- * component might want to register in activity history.
- * Needs to be implemented in component's information
- * class.
- *
- * @return array|null collection of activity types
- */
- public function getActivityTypes() {
- return NULL;
- }
-
- /**
- * @param $shortCuts
- */
- public function creatNewShortcut(&$shortCuts) {}
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * This class holds all the Pseudo constants that are specific to this component.
- */
-class CRM_Touchstone_PseudoConstant extends CRM_Core_PseudoConstant {
-
- /**
- * pseudoconstant definition
- * @var array
- */
- private static $pseudoConst;
-
- /**
- * Get all values for $pseudoConst pseudoconstant
- *
- * @param null $id
- *
- * @return array - array reference of all $pseudoConst values
- */
- public static function &pseudoConst($id = NULL) {
- return self::$pseudoConst;
- }
-}
-
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*/
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * class to represent the actions that can be performed on a group of contacts
- * used by the search forms
- *
- */
-class CRM_Touchstone_Task {
- const FIRST_ACTION = 1, SECOND_ACTION = 2, THIRD_ACTION = 3;
-
- /**
- * the task array
- *
- * @var array
- */
- static $_tasks = NULL;
-
- /**
- * the optional task array
- *
- * @var array
- */
- static $_optionalTasks = NULL;
-
- /**
- * These tasks are the core set of tasks that the user can perform
- * on a contact / group of contacts
- *
- * @return array the set of tasks for a group of contacts
- */
- static function &tasks() {
- if (!(self::$_tasks)) {
- self::$_tasks = array(
- 1 => ts('Perform First Task'),
- 2 => ts('Perform Second Task'),
- 5 => ts('Perform Third Task'),
- );
- }
- return self::$_tasks;
- }
-}
-