function CreateSubmitButton($btnText, $vals = array()) { return CreateNavButton($btnText, '', $vals); /*return; if (empty($vals['next_url'])) $vals['next_url'] = htmlspecialchars($_SERVER['REQUEST_URI']); $out = ""; $sets = ""; foreach ($vals as $key => $val) { AddHiddenField($key); $sets .= " SetElementValue(\"$key\",\"$val\");"; } $sets = trim($sets); $onClick = trim($onClick); if (!empty($onClick) && substr($onClick, -0) != ';') $onClick = $onClick.';'; $out .= " <input type=submit value='$btnText' onclick='$onClick$sets' />"; return $out;*/ }
public function _RunModule() { $this->AssertURL(); if ($this->isDisabled) { echo $this->isDisabled; return; } // build linklist of children $children = utopia::GetChildren(get_class($this)); foreach ($children as $child => $links) { $obj = utopia::GetInstance($child); foreach ($links as $info) { if ($obj->flag_is_set(ALLOW_ADD) && !$this->flag_is_set(ALLOW_ADD) && is_subclass_of($child, 'uSingleDataModule') && ($info['parentField'] === NULL || $info['parentField'] === '*')) { $url = $obj->GetURL(array('_n_' . $obj->GetModuleId() => '1')); utopia::LinkList_Add('list_functions:' . get_class($this), null, CreateNavButton('New ' . $obj->itemName, $url, array('class' => 'new-item')), 1); } } } // BEFORE ob_start(); $beforeResult = uEvents::TriggerEvent('BeforeRunModule', $this); $beforeContent = ob_get_clean(); if (utopia::UsingTemplate() && $beforeContent) { $beforeContent = '<div class="module-container ' . get_class($this) . ' BeforeRunModule">' . $beforeContent . '</div>'; } echo $beforeContent; if ($beforeResult === FALSE) { return FALSE; } // RUN ob_start(); $result = $this->RunModule(); $runContent = ob_get_clean(); if (utopia::UsingTemplate() && $runContent) { $runContent = '<div class="module-container ' . get_class($this) . ' RunModule">' . $runContent . '</div>'; } echo $runContent; if ($result === FALSE) { return false; } $this->hasRun = true; // AFTER ob_start(); $afterResult = uEvents::TriggerEvent('AfterRunModule', $this); $afterContent = ob_get_clean(); if (utopia::UsingTemplate() && $afterContent) { $afterContent = '<div class="module-container ' . get_class($this) . ' AfterRunModule">' . $afterContent . '</div>'; } echo $afterContent; if ($afterResult === FALSE) { return FALSE; } }
public function publishLinks($field, $pkVal, $v, $rec) { if ($rec['is_published'] && $rec['content_time'] == $rec['content_published_time']) { return utopia::DrawInput('published', itBUTTON, 'Published') . $this->DrawSqlInput('unpublish', 'Unpublish', $pkVal, array('title' => 'Remove this page from public view', 'class' => 'page-unpublish'), itBUTTON); } // preview, publish, revert (red) $obj = utopia::GetInstance('uCMS_View'); $preview = CreateNavButton('Preview', $obj->GetURL(array('cms_id' => $pkVal, 'preview' => 1)), array('target' => '_blank', 'title' => 'Preview this page')); $revert = $this->DrawSqlInput('revert', 'Revert', $pkVal, array('title' => 'Reset to published version', 'class' => 'page-revert'), itBUTTON); $publish = $this->DrawSqlInput('publish', 'Publish', $pkVal, array('title' => 'Make this page live', 'class' => 'page-publish btn-green'), itBUTTON); return $preview . $revert . $publish; }