stringToPath() public static method

public static stringToPath ( $pathstring )
Beispiel #1
0
 public function insertCriterion($pathstring, $criterion, $cvalue, $operator, $value)
 {
     $path = Whups_Query::stringToPath($pathstring);
     $qobj =& $this->query;
     $value = trim($value);
     if ($value[0] == '"') {
         // FIXME: The last character should be '"' as well.
         $value = substr($value, 1, -1);
     } else {
         $pn = $this->_getParameterName($value);
         if ($pn !== null) {
             $this->parameters[] = $pn;
         }
     }
     $newbranch = array('type' => Whups_Query::TYPE_CRITERION, 'criterion' => $criterion, 'cvalue' => $cvalue, 'operator' => $operator, 'value' => $value);
     $count = count($path);
     for ($i = 0; $i < $count; $i++) {
         $qobj =& $qobj['children'][$path[$i]];
     }
     $qobj['children'][] = $newbranch;
 }
Beispiel #2
0
                $qf = 'props';
            }
            $session->set('whups', 'query_form', $qf);
            $vars->set('edit', true);
            break;
    }
    $vars->remove('qaction1');
    $vars->remove('qaction2');
} elseif ($vars->get('formname')) {
    // Now check for submitted forms.
    $class = $vars->get('formname');
    $form = new $class($vars);
    if ($form->validate($vars)) {
        if ($vars->get('edit')) {
            $whups_query->deleteNode($vars->get('path'));
            $path = Whups_Query::stringToPath($vars->get('path'));
            array_pop($path);
            $vars->set('path', Whups_Query::pathToString($path));
            $vars->remove('edit');
        }
        $form->execute($vars);
        $vars->remove('action');
    }
} elseif ($vars->get('action') != '') {
    // Last, check for actions from tabs.
    $action = $vars->get('action');
    switch ($action) {
        case 'new':
            $whups_query = $qManager->newQuery();
            break;
        case 'delete':