public function info($pa_parameters)
 {
     parent::info($pa_parameters);
     $t_tour = $this->view->getVar('t_item');
     if ($t_tour->getPrimaryKey()) {
         $va_labels = $t_tour->getDisplayLabels();
         $this->view->setVar('labels', $t_tour->getPrimaryKey() ? $va_labels : array());
         $this->view->setVar('idno', $t_tour->get('idno'));
     }
     $t_stop = new ca_tour_stops();
     $t_stop->load(array('tour_id' => $t_tour->getPrimaryKey(), 'parent_id' => null));
     $this->view->setVar('t_stop', $t_stop);
     if ($vn_stop_id = $t_stop->getPrimaryKey()) {
         $va_children = caExtractValuesByUserLocaleFromHierarchyChildList($t_stop->getHierarchyChildren(null, array('additionalTableToJoin' => 'ca_tour_stop_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('name', 'locale_id'))), 'stop_id', 'name', 'idno');
         $this->view->setVar('children', $va_children);
     }
     return $this->render('widget_tour_info_html.php', true);
 }
Exemple #2
0
 /** 
  *
  */
 public function removeStop($pn_stop_id)
 {
     if (!($vn_tour_id = $this->getPrimaryKey())) {
         return false;
     }
     $t_stop = new ca_tour_stops();
     if ($this->inTransaction()) {
         $t_stop->setTransaction($this->getTransaction());
     }
     if (!$t_stop->load(array('tour_id' => $vn_tour_id, 'stop_id' => $pn_stop_id))) {
         return false;
     }
     $t_stop->setMode(ACCESS_WRITE);
     return $t_stop->delete(true);
 }
Exemple #3
0
 /**
  * Returns name of hierarchy for currently loaded row or, if specified, row identified by optional $pn_id parameter
  */
 public function getHierarchyName($pn_id = null)
 {
     if (!$pn_id) {
         $pn_id = $this->getPrimaryKey();
     }
     $va_ancestors = $this->getHierarchyAncestors($pn_id, array('idsOnly' => true));
     if (is_array($va_ancestors) && sizeof($va_ancestors)) {
         $vn_parent_id = array_pop($va_ancestors);
         $t_stop = new ca_tour_stops($vn_parent_id);
         return $t_stop->getLabelForDisplay(false);
     } else {
         if ($pn_id == $this->getPrimaryKey()) {
             return $this->getLabelForDisplay(true);
         } else {
             $t_stop = new ca_tour_stops($pn_id);
             return $t_stop->getLabelForDisplay(false);
         }
     }
 }
/**
 * Fetch stop_id for stop with specified idno in tour
 *
 * @param string $ps_tour_code Tour code
 * @param string $ps_idno idno of stop to return stop_id for
 * @return int item_id of list item or null if no matching item was found
 */
function caGetTourStopID($ps_tour_code, $ps_idno)
{
    $vn_tour_id = caGetTourID($ps_tour_code);
    $t_stop = new ca_tour_stops();
    return $t_stop->load(array('tour_id' => $vn_tour_id, 'idno' => $ps_idno));
}