public function update_permission($array) { global $webdb; if ($array["group_id"]) { $id_category = "group_id"; } else { $id_category = "admin_id"; } $id = $array[$id_category]; $pary = $array['perm']; if (permission::check('_sys_group_perm', 'e_tag')) { $sql = "delete from _sys_group_perm where " . $id_category . "='" . $id . "';"; $webdb->query($sql); // foreach($pary as $perm_id => $data){ // if(in_array($perm_id,$array['perm_id'])){ // $data['group_id']=$id; // $data['perm_id']=$perm_id; // $webdb->insert($data,'_sys_group_perm'); // } // } foreach ($array['perm_id'] as $perm_id) { $data = array(); if ($pary[$perm_id]) { $data = $pary[$perm_id]; } $data[$id_category] = $id; $data['perm_id'] = $perm_id; $webdb->insert($data, '_sys_group_perm'); unset($data); } } }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.Main", new HTMLEditorField("RedirectText", "Text Explaining PayPal Redirect"), "Metadata"); if (permission::check('ADMIN')) { $fields->addFieldToTab("Root.PayPalSettings", new TextField("PayPalAccount", "PayPal Account (email address)")); } return $fields; }
public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab('Root.Main.Metadata', $keywordsField = new TextareaField('MetaKeywords', 'Meta Keywords'), "ExtraMeta"); $fields->addFieldToTab('Root.Main.Metadata', new TextField('MetaTitle', 'Meta Title'), 'MetaDescription'); foreach (array('MetaTitle', 'MetaDescription', 'MetaKeywords') as $MetaFieldName) { $oldField = $fields->dataFieldByName($MetaFieldName); $oldField->setTitle($oldField->Title() . '<span class="field_count">' . strlen($this->owner->{$MetaFieldName}) . '</span>'); } $keywordsField->setRows(1); if (permission::check('ADMIN')) { $fields->addFieldToTab("Root.Main", new CheckboxField("NoFollow", "Set nav link to no-follow?"), "MetaDescription"); $fields->addFieldToTab('Root.Main.Metadata', new TextareaField('URLRedirects', '301 Redirects')); } return $fields; }
public function updateCMSFields(FieldList $fields) { if (permission::check('ADMIN')) { $fields->addFieldToTab('Root.AdditionalCode', $codeField = new CodeEditorField('AdditionalCode', 'Additional HTML/JS/CSS Code', 50)); $codeField->addExtraClass('stacked'); $codeField->setRows(45); $codeField->setMode('html'); } if ($this->owner->ClassName == "Page") { $fields->addFieldToTab("Root.Columns", new HTMLEditorField("LeftColumn", "Left Column Content")); $fields->addFieldToTab("Root.Columns", new HTMLEditorField("CenterColumn", "Center Column Content")); $fields->addFieldToTab("Root.Columns", new HTMLEditorField("RightColumn", "Right Column Content")); $fields->addFieldToTab("Root.Sidebar", new HTMLEditorField("SidebarContent", "Sidebar Content")); } return $fields; }
$class = new $className(); if ($_POST) { if ($_POST['id']) { $_POST['id'] = (int) $_GET["id"]; $class->edit($_POST, $_POST['id']); $altmsg = '修改' . $classStr . '成功'; } else { $class->add($_POST); // go(urlkill('altmsg').'&altmsg='.urlencode('新增'.$classStr.'成功')); $altmsg = '新增' . $classStr . '成功'; } } if ($_GET['id']) { $info = $class->getInfo($_GET['id']); } else { if (!permission::check($class->tableName, "a_tag")) { echo "<script>alert('對不起你沒有該操作的權限');</script>"; exit; } } ?> <form method="post" onsubmit="return checkForm(this);" enctype="multipart/form-data"> <?php if ($_GET['id']) { ?> <input type="hidden" name="id" value="<?php echo $_GET['id']; ?> "><?php } ?>
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.Sidebar", new HTMLEditorField("SidebarContent", "Sidebar Content Top")); $fields->addFieldToTab("Root.Sidebar", new HTMLEditorField("SidebarBottom", "Sidebar Content Bottom")); $fields->addFieldToTab('Root.MapDetails', new GridField('ServiceAreasLocations', 'Locations', $this->ServiceAreasLocations(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'), 'GridFieldButtonRow'))); if (permission::check('ADMIN')) { $fields->addFieldToTab("Root.MapDetails", new UploadField("MapIcon", "Map Marker Image")); } $fields->addFieldToTab("Root.MapDetails", new DropdownField("MapType", "Map Display Type", array("ROADMAP" => "Roadmap", "SATELLITE" => "Satellite", "HYBRID" => "Hybrid", "TERRAIN" => "Terrain"), "Roadmap")); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("FirstName_Control", "First Name", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("LastName_Control", "Last Name", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("Address_Control", "Address", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("Address2_Control", "Address 2", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("City_Control", "City", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("State_Control", "State", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("ZipCode_Control", "Zip Code", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("Phone_Control", "Phone Number", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("Email_Control", "Email Address", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab("Root.FormControls.Fields", new CheckboxSetField("Comments_Control", "Comments", array("Enabled" => "Enabled", "Required" => "Required"))); $fields->addFieldToTab('Root.FormSubmissions', new GridField('ServiceAreasFormSubmissions', 'Submissions', $this->ServiceAreasFormSubmissions(), GridFieldConfig_RecordEditor::create()->addComponent($exportBtn = new GridFieldExportButton(), 'GridFieldButtonRow'))); $ExportFields = array("Date" => "Date", "FirstName" => "First Name", "LastName" => "Last Name", "Address" => "Address", "City" => "City", "State" => "State", "ZipCode" => "Zip Code", "Email" => "Email Address", "Phone" => "Phone Number", "PageURL" => "Page URL", "Comments" => "Comments"); $this->extend('updateExportFields', $ExportFields); $exportBtn->setExportColumns($ExportFields); $fields->addFieldToTab("Root.FormControls.Recipients", new LiteralField("Desc1", "<h3>Forms will be submitted to all addresses below.</h3><br>")); $fields->addFieldToTab('Root.FormControls.Recipients', new GridField('FormRecipients', 'Recipients', $this->FormRecipients(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'), 'GridFieldButtonRow'))); $fields->addFieldToTab("Root.FormControls.ThankYouText", new HTMLEditorField("ThankYouText", "Text on Submission")); if (permission::check('ADMIN')) { $fields->addFieldToTab("Root.PageCreation", new LiteralField("M0", "<h1>This tool lets you create service area pages with base content. YOU MUST REFRESH the admin area after saving this page to see your new content.</h1>")); $fields->addFieldToTab("Root.PageCreation", new LiteralField("M1", "<p>Enter some content below, and it will be the default content for all pages made with this tool.</p><p>You may optionally add {NAME} to the content, and it will be magically replaced with the page name</p>")); $fields->addFieldToTab("Root.PageCreation", new HTMLEditorField("BaseContent", "Base Content")); $fields->addFieldToTab("Root.PageCreation", new TextField("BasePageTitle", "Base Page Title")); $fields->addFieldToTab("Root.PageCreation", new TextField("BaseMetaTitle", "Base Meta Title")); $fields->addFieldToTab("Root.PageCreation", new TextAreaField("BaseMetaKeywords", "Base Meta Keywords")); $fields->addFieldToTab("Root.PageCreation", new TextAreaField("BaseMetaDescription", "Base Meta Description")); $fields->addFieldToTab("Root.PageCreation", new LiteralField("M2", "<br><br><h3>Below you can enter page names for automatic generation.</h3><p>One page name per line</p><p>First level pages can simply be typed on a line.</p><p>Children pages must start with a tilde ~ for each level of nesting.</p><h4>Example:</h4><p>Heading Page Name</p><p>~Child Page Name</p><p>~Child Page Name</p><p>~~Sub Child Page Name</p><p>Heading Page Name</p><p>~Child Page Name</p>")); $fields->addFieldToTab("Root.PageCreation", new TextAreaField("PageStructure", "Page Structure")); } return $fields; }
function delete($id) { global $webdb; //print_r($this->permCheck && !permission::check($this->tableName,'d_tag'));exit; if ($this->tableName && $this->permCheck && !permission::check($this->tableName, 'd_tag')) { permission::errMsg(); return false; } return $webdb->query("delete from " . $this->tableName . " where " . $this->key . "='" . $id . "'"); }