Ejemplo n.º 1
0
 function &getFields()
 {
     if (!self::$_bookingFields) {
         self::$_bookingFields = array_merge(self::$_bookingFields, CRM_Booking_DAO_Booking::export());
     }
     return self::$_bookingFields;
 }
Ejemplo n.º 2
0
 /**
  * Class constructor
  *
  * @param array   $queryParams array of parameters for query
  * @param int     $action - action of search basic or advanced.
  * @param string  $bookingClause if the caller wants to further restrict the search (used in bookings)
  * @param boolean $single are we dealing only with one contact?
  * @param int     $limit  how many booking do we want returned
  *
  * @return CRM_Contact_Selector
  * @access public
  */
 function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $bookingClause = NULL, $single = FALSE, $limit = NULL, $context = 'search')
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_bookingClause = $bookingClause;
     // type of selector
     $this->_action = $action;
     /*
         $bookingQuery = CRM_Booking_BAO_Query::defaultReturnProperties(
           CRM_Booking_BAO_BookingContactQuery::MODE_BOOKING,
           FALSE
         );
     
         $this->_query = new CRM_Booking_BAO_BookingContactQuery(
           $this->_queryParams,
           $bookingQuery,
           NULL,
           FALSE,
           FALSE,
           CRM_Booking_BAO_BookingContactQuery::MODE_BOOKING
         );*/
     $defaultReturnProperties = CRM_Booking_BAO_Query::defaultReturnProperties();
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, $defaultReturnProperties, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTACTS);
     $this->_query->_distinctComponentClause = " civicrm_booking.id";
     $this->_query->_groupByComponentClause = " GROUP BY civicrm_booking.id ";
 }
Ejemplo n.º 3
0
 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     // text for sort_name
     $this->addElement('text', 'sort_name', ts('Contact Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     CRM_Booking_BAO_Query::buildSearchForm($this);
     /*
      * add form checkboxes for each row. This is needed out here to conform to QF protocol
      * of all elements being declared in builQuickForm
      */
     $rows = $this->get('rows');
     if (is_array($rows)) {
         if (!$this->_single) {
             $this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('onclick' => "toggleTaskAction( true ); return toggleCheckboxVals('mark_x_',this);"));
             foreach ($rows as $row) {
                 $this->addElement('checkbox', $row['checkbox'], NULL, NULL, array('onclick' => "toggleTaskAction( true ); return checkSelectedBox('" . $row['checkbox'] . "');"));
             }
         }
         $total = $cancel = 0;
         $permission = CRM_Core_Permission::getPermission();
         $tasks = array('' => ts('- actions -')) + CRM_Booking_Form_Task::permissionedTaskTitles($permission);
         $this->add('select', 'task', ts('Actions:') . ' ', $tasks);
         $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 0);"));
         //-- Remove print button as it causes an exception when pressed
         //-- TODO : Bring back search results print button functionality (See: PCBK-182)
         // $this->add('submit', $this->_printButtonName, ts('Print'),
         // array(
         // 'class' => 'form-submit',
         // 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1);",
         // )
         // );
         // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
         $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array('checked' => 'checked'));
         $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all', array('onclick' => $this->getName() . ".toggleSelect.checked = false; toggleCheckboxVals('mark_x_',this); toggleTaskAction( true );"));
     }
     // add buttons
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
 }