protected function getJstreeAjaxCallback()
 {
     $types = array_keys($this->getOption('peer_class'));
     return strtr('function (n) { 
         return { 
             security_token: "%security_token%",
             operation: n == -1? "get_root":"get_children",
             node_id: n == -1? -1 : n.data("id"),
             node_type: n == -1? -1 : n.attr("rel"),
             peer_class: "%peer_class%",
             peer_id_column: "%peer_id_column%",
             peer_parent_id_column: "%peer_parent_id_column%",
             criteria: "%criteria%",
             root_nodes_criteria: "%root_nodes_criteria%",
             peer_method: "%peer_method%",
             peer_count_method: "%peer_count_method%",
             peer_to_string_method: "%peer_to_string_method%",
             peer_types: "%peer_types%",
             peer_root_type: "%peer_root_type%",
             peer_type_relationships: "%peer_type_relationships%",
                };
             }', array("%security_token%" => $this->encode(crWidgetFormJsTreeAjaxPropel::getSecurityToken(serialize($this->getOption('peer_class')), serialize($this->getOption('peer_parent_id_column')), serialize($this->getOption('peer_id_column')), serialize($this->getOption('criteria')), serialize($this->getOption('peer_method')), serialize($this->getOption('peer_count_method')), serialize($this->getOption('peer_to_string_method')))), "%peer_class%" => $this->encode(serialize($this->getOption('peer_class'))), "%peer_id_column%" => $this->encode(serialize($this->getOption('peer_id_column'))), "%peer_parent_id_column%" => $this->encode(serialize($this->getOption('peer_parent_id_column'))), "%criteria%" => $this->encode(serialize($this->getOption('criteria'))), "%root_nodes_criteria%" => $this->encode(serialize($this->getOption('root_nodes_criteria'))), "%peer_method%" => $this->encode(serialize($this->getOption('peer_method'))), "%peer_count_method%" => $this->encode(serialize($this->getOption('peer_count_method'))), "%peer_to_string_method%" => $this->encode(serialize($this->getOption('peer_to_string_method'))), "%peer_types%" => $this->encode(serialize($types)), "%peer_root_type%" => $this->encode(serialize($this->getOption('peer_root_type'))), "%peer_type_relationships%" => $this->encode(serialize($this->getOption('peer_type_relationships')))));
 }
Пример #2
0
 /**
  * Validates security token
  *
  * @return boolean
  */
 private function validateCrJsTreePropelSecurityToken(sfWebRequest $request)
 {
     $security_token = $this->decodeCrJsTreePropel($request->getParameter('security_token'));
     $operation = $this->decodeCrJsTreePropel($request->getParameter('operation'));
     $peer_class = $this->decodeCrJsTreePropel($request->getParameter('peer_class'));
     $peer_parent_id_column = $this->decodeCrJsTreePropel($request->getParameter('peer_parent_id_column'));
     $peer_id_column = $this->decodeCrJsTreePropel($request->getParameter('peer_id_column'));
     $criteria_serialized = $this->decodeCrJsTreePropel($request->getParameter('criteria'));
     $peer_method = $this->decodeCrJsTreePropel($request->getParameter('peer_method'));
     $peer_count_method = $this->decodeCrJsTreePropel($request->getParameter('peer_count_method'));
     $peer_to_string_method = $this->decodeCrJsTreePropel($request->getParameter('peer_to_string_method'));
     return crWidgetFormJsTreeAjaxPropel::getSecurityToken($peer_class, $peer_parent_id_column, $peer_id_column, $criteria_serialized, $peer_method, $peer_count_method, $peer_to_string_method) == $security_token;
 }