add(ExportFieldPeer::MODEL, $object->getModel()); $c->add(ExportFieldPeer::IS_KEY, 0); $objects = sfPropelManyToMany::getAllObjects($object, $through_class, $c); if (sfContext::getInstance()->getRequest()->hasErrors()) { $ids = sfContext::getInstance()->getRequest()->getParameterHolder()->get('associated_field', 0); $c = new Criteria(); $c->add(ExportFieldPeer::ID, $ids, Criteria::IN); $objects_associated = ExportFieldPeer::doSelect($c); } else { $objects_associated = sfPropelManyToMany::getRelatedObjects($object, $through_class, $c); } $ids = array_map(create_function('$o', 'return $o->getPrimaryKey();'), $objects_associated); return array($objects, $objects_associated, $ids); } function st_export_type_picker($name, $value, array $options = array()) { $content = ''; foreach ($options['types'] as $type => $label) { $label = __($label, array(), 'stImportExportBackend'); $radio = radiobutton_tag($name, $type, $value == $type); $content .= content_tag('li', content_tag('label', $radio . ' ' . $label, array( 'style' => 'float: none; width: auto' ))); } return content_tag('ul', $content); } function st_export_profile_picker($name, $value, array $options = array()) { $module = $options['module']; $model = $options['model']; $profiles = $options['profiles']; $url = 'stImportExportBackend/list?model='.$model.'&for_module='.$module; $forwardParameters = stAdminGeneratorHelper::filterAdditionalParameters($options['forward_parameters']); foreach ($forwardParameters as $forwardParameterName => $value) { $url .= "&$forwardParameterName=$value"; } if (!empty($forwardParameters)) { $url .= '¶meters=' . implode(',', array_keys($forwardParameters)); } $select = select_tag($name, options_for_select($profiles, $value)); $link = st_get_admin_button('default', __('ZarzÄ…dzaj profilami', array(), 'stImportExportBackend'), $url, array('size' => 'small', 'class' => 'bs-mt-2', 'icon' => 'stImportExportPlugin')); return $select . '
' . $link; } function st_export_custom_parameter($name, $value, array $options = array()) { $parameters = $options['parameters']; $parameterName = $options['parameter_name']; $type = isset($parameters['type']) ? $parameters['type'] : 'input_tag'; $default = isset($parameters['default']) ? $parameters['default'] : null; switch ($type) { case 'checkbox_tag': $content = st_admin_checkbox_tag($name, 1, $default); break; case 'select_tag': if (!isset($parameters['choices'])) { throw new Exception(sprintf('Missing choices parameter for %s', $parameterName)); } $content = select_tag($name, options_for_select($parameters['choices'], $default)); break; default: $content = $type($name, $default); break; } return $content; }