/** * Отрисовать печать по шаблону * * @param array $item */ private function renderMenuItemPrint(array $item) { // кнопка печати по шаблону echo '<div class="menu_item_container">'; echo '<a href="' . WEB_ROOT . '_modules/_print/?action=ShowForms&template=' . $item['template'] . '" asu-action="flow">'; $formset = CPrintManager::getFormset($item["template"]); if (!is_null($formset)) { $var = $formset->computeTemplateVariables(); foreach ($var as $key => $value) { echo '<div asu-type="flow-property" name="' . $key . '" value="' . $value . '"></div>'; } } echo '<div><img src="' . WEB_ROOT . 'images/' . ICON_THEME . '/32x32/' . $item['icon'] . '"></div>'; echo $item['title']; echo '</a>'; echo '</div>'; self::$childContainers++; }
/** * Все поля * * @return CArrayList */ public static function getAllFields() { if (!self::$_cacheFieldInit) { self::$_cacheFieldInit = true; foreach (CActiveRecordProvider::getAllFromTable(TABLE_PRINT_FIELDS)->getItems() as $item) { $field = new CPrintField($item); self::getCacheField()->add($field->getId(), $field); } } return self::getCacheField(); }
public function actionDelete() { $formset = CPrintManager::getFormset(CRequest::getInt("id")); $formset->remove(); $this->redirect("?action=index"); }
public function actionDelete() { $field = CPrintManager::getField(CRequest::getInt("id")); $field->remove(); $this->redirect("?action=index"); }
/** * Подготоваливает к вывод данные для печати группы * записей по указанному шаблону * * @param $template */ public static function printGroupOnTemplate($template) { $formset = CPrintManager::getFormset($template); if (!is_null($formset)) { $forms = $formset->activeForms; $variables = $formset->computeTemplateVariables(); echo "<ul>"; foreach ($forms->getItems() as $form) { echo '<li><a href="#" onclick="printWithTemplate('; echo "'" . $variables['manager'] . "'"; echo ", '" . $variables['method'] . "'"; echo ", '" . $form->getId() . "'"; echo '); return false;">' . $form->title . '</a></li>'; } echo "</ul>"; } }
public function actionPrePrintWithTemplate() { if ($this->getSelectedInPickListDialog()->getCount() == 0) { return true; } $selectedForm = CPrintManager::getForm($this->getSelectedInPickListDialog()->getFirstItem()); if (!is_null($selectedForm)) { /** * Если это форма без диалога параметров, то просто перекинем * пользователя на страницу генерации документа */ if ($selectedForm->properties_show_dialog != "1") { $formset = $selectedForm->formset; $variables = $formset->computeTemplateVariables(); /* $url = WEB_ROOT."_modules/_print/?action=print". "&manager=".$variables['manager']. "&method=".$variables['method']. "&id=".$variables['id']. "&template=".$selectedForm->getId(); */ $url = WEB_ROOT . "_modules/_print/?action=print" . "&template=" . $selectedForm->getId(); foreach (self::getStatefullBean()->getItems() as $key => $value) { $url .= "&" . $key . "=" . $value; } $this->redirect($url); } else { // тут с диалогом, передадим ему управление self::getStatefullBean()->add("template", $selectedForm->getId()); $this->redirectNextAction($selectedForm->properties_controller, $selectedForm->properties_method); } } }