Inheritance: extends DataObject
 protected function validate()
 {
     $required = array("class_level" => "Class", "section" => "Section", "code" => "Code");
     global $user;
     if ($user->checkAdmin() == true) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             echo 'Saving...';
             global $objPDO;
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_class.php';
             $section = new Section($objPDO);
             $section->setClass($_POST['class_level']);
             $section->setSection($_POST['section']);
             $section->setCode($_POST['code']);
             $section->save();
             echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/miscellaneous"/>';
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }
示例#2
0
 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error($translator->trans('Language does not exist.'));
     }
     $uri = '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error($translator->trans('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error($translator->trans('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error($translator->trans('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
示例#3
0
 /**
  * Register the article's metadata with the SWORD deposit.
  */
 function setMetadata()
 {
     $this->package->setCustodian($this->journal->getSetting('contactName'));
     $this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8'));
     $this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8'));
     $this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale()));
     // The article can be published or not. Support either.
     if (is_a($this->article, 'PublishedArticle')) {
         $doi = $this->article->getPubId('doi');
         if ($doi !== null) {
             $this->package->setIdentifier($doi);
         }
     }
     foreach ($this->article->getAuthors() as $author) {
         $creator = $author->getFullName(true);
         $affiliation = $author->getAffiliation($this->journal->getPrimaryLocale());
         if (!empty($affiliation)) {
             $creator .= "; {$affiliation}";
         }
         $this->package->addCreator($creator);
     }
     // The article can be published or not. Support either.
     if (is_a($this->article, 'PublishedArticle')) {
         $plugin = PluginRegistry::loadPlugin('citationFormats', 'bibtex');
         $this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8'));
     }
 }
示例#4
0
 public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
 {
     $languageObj = new Language($p_languageId);
     if (!$languageObj->exists()) {
         return new PEAR_Error(getGS('Language does not exist.'));
     }
     $uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
     if (!is_null($p_issueNo) && is_null($p_articleNo)) {
         $issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
         if (!$issueObj->exists()) {
             return new PEAR_Error(getGS('Issue does not exist.'));
         }
         $uri .= $issueObj->getUrlName() . '/';
     }
     if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
         $sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
         if (!$sectionObj->exists()) {
             return new PEAR_Error(getGS('Section does not exist.'));
         }
         $uri .= $sectionObj->getUrlName() . '/';
     }
     if (!is_null($p_articleNo)) {
         $articleObj = new Article($p_languageId, $p_articleNo);
         if (!$articleObj->exists()) {
             return new PEAR_Error(getGS('Article does not exist.'));
         }
         $issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
         $sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
         $uri .= $issueObj->getUrlName() . '/';
         $uri .= $sectionObj->getUrlName() . '/';
         $uri .= $articleObj->getUrlName() . '/';
     }
     return $uri;
 }
示例#5
0
 function getCriteria()
 {
     $total_crit = array();
     $article_search = new Article($this->dbcon);
     if ($crit = $this->getData('sqlwhere')) {
         if ($bad_spot = strpos($crit, "or typeid")) {
             $crit = substr($crit, 0, $bad_spot) . ")";
         }
         $total_crit[] = $crit;
     }
     if ($id = $this->getData('class_id')) {
         #$total_crit[] = "class =".$id;
         $total_crit[] = $article_search->makeCriteriaClass($id);
     }
     if ($id = $this->getData('section_id')) {
         $section = new Section($this->dbcon, $id);
         $section_crit = $section->getDisplayCriteria();
         $crit = join(' AND ', $article_search->makeCriteria($section_crit));
         $total_crit[] = $crit;
     }
     if (empty($total_crit)) {
         return $article_search->makeCriteriaDisplayable();
     }
     return "( " . join(" " . $this->getCombineLogic() . " ", $total_crit) . " ) AND " . $article_search->makeCriteriaDisplayable();
 }
示例#6
0
文件: view.php 项目: blumine/vunsy
function printS($id)
{
    $ci =& get_instance();
    $s = new Section();
    $s->get_by_id($id);
    $s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit');
    $s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete');
    $output = "<li>";
    $output .= $s->id . '|';
    $output .= $s->name;
    $output .= add($id, 0, "add first child for {$s->name}");
    $output .= '|';
    $output .= $s->e;
    $output .= '|';
    $output .= $s->d;
    $c = new Section();
    $c->where('parent_section', $id);
    $c->order_by('sort', 'asc');
    $c->get();
    if (count($c->all) > 0) {
        $output .= "<ul>";
        foreach ($c->all as $item) {
            $output .= printS($item->id);
            $output .= "<li>" . add($id, $item->sort + 1) . "</li>";
        }
        $output .= "</ul>";
    }
    $output .= "</li>";
    return $output;
}
示例#7
0
 public static function remove($name)
 {
     $sectionManager = new Section();
     $sectionManager->load(array('label' => $name));
     $rightManager = new Right();
     $rightManager->delete(array('section' => $sectionManager->getId()));
     $sectionManager->delete(array('id' => $sectionManager->getId()));
 }
示例#8
0
 /**
  * The official register section function. Section on instantiation calls this function
  * so that you don't have to. All sections should be registered with this manager.
  * If you care about overriding this, message me or fork + Singleton it / change it.
  *
  * @param Section $section
  *
  * @return bool
  */
 public static function registerSection(Section $section)
 {
     $uid = $section->getUID();
     if (isset(self::$__sections[$uid])) {
         return false;
     }
     self::$__sections[$uid] = $section;
     return true;
 }
示例#9
0
 public static function findEntries($entries, Section $section)
 {
     $entries = explode(',', $entries);
     $ret = EntryManager::fetch($entries, $section->get('id'));
     if ($ret === false) {
         self::throwEx('An error occurred while processing entries');
     }
     return $ret;
 }
示例#10
0
 /**
  * getIndex() and setIndex() should get and set the index, respectively
  */
 public function testGetSetIndex()
 {
     $index = 999;
     $section = new Section();
     $section->setIndex($index);
     $expected = $index;
     $actual = $section->getIndex();
     $this->assertEquals($expected, $actual);
     return;
 }
示例#11
0
 public function index()
 {
     $valida = $this->protect->access_page('FDT');
     $this->plantilla->loadSec("fdt/fdt", $valida);
     $section = new Section();
     $tps_index_control['menu'] = $section->menu('FDT');
     $tps_index_control['header'] = $section->header();
     $tps_index_control['footer'] = $section->footer();
     $this->plantilla->set($tps_index_control);
     $this->plantilla->getCache();
 }
示例#12
0
 public function index()
 {
     $valida = $this->protect->access_page('INVENTARIO');
     $this->plantilla->loadSec("inventario/inventario", $valida, 360000);
     $section = new Section();
     $tps_index_control['menu'] = $section->menu('INVENTARIO');
     $tps_index_control['header'] = $section->header();
     $tps_index_control['footer'] = $section->footer();
     $this->plantilla->set($tps_index_control);
     $this->plantilla->finalize();
 }
示例#13
0
 public function perfil()
 {
     $this->plantilla->load("login/login_perfil");
     $section = new Section();
     $tps_index_control['menu'] = $section->menu('Profile');
     $tps_index_control['header'] = $section->header();
     $tps_index_control['footer'] = $section->footer(false, true, false);
     $tps_index_control['PROFILE'] = $this->language->PROFILE;
     $this->plantilla->set($tps_index_control);
     $this->plantilla->finalize();
 }
示例#14
0
文件: Parser.php 项目: programie/pini
 private function addProperty($key, $value)
 {
     $property = $this->currentSection->getProperty($key);
     if (!$property) {
         $property = new Property($key);
         $this->currentSection->addProperty($property);
     }
     $property->value = $value;
     $property->comment = $this->commentBlock;
     $this->commentBlock = array();
 }
    function build_list_item($id, $title, $class = '', $current = '')
    {
        $section = new Section(AMP_Registry::getDbcon(), $id);
        if (!$section->isLive()) {
            return '';
        }
        $html = '';
        $html .= '<li class="sidelist ' . $class . '">
<a class="' . $current . 'sidelist_link" href="article.php?list=type&type=' . $id . '">' . $title . '</a>
</li>';
        return $html;
    }
示例#16
0
 public function index()
 {
     $valida = $this->protect->access_page('ADMINISTRACION');
     $this->plantilla->loadSec("administracion/administracion", $valida, 36000);
     $section = new Section();
     $tps_index_control['menu'] = $section->menu('ADMINISTRACION');
     $tps_index_control['header'] = $section->header();
     $tps_index_control['footer'] = $section->footer();
     $tabs[] = array('title' => $this->language->USERS, 'urlBase' => true, 'href' => 'admin/user', 'protec' => 'ADMINISTRATION_USER');
     $tabs[] = array('title' => $this->language->GROUP, 'urlBase' => true, 'href' => 'admin/groups', 'protec' => 'ADMINISTRATION_GROUPS');
     $tabs[] = array('title' => $this->language->AUDIT, 'urlBase' => true, 'href' => 'admin/audit', 'protec' => 'ADMINISTRATION_AUDIT');
     /*		Bmonitor 2.5
     		$tabs[] = array(
     			'title' => $this->language->TEMPLATE_LANG,
     			'urlBase' => true,
     			'href' => 'admin/template',
     			'protec' => 'ADMINISTRATION_TEMPLATE'
     		);
     
     		$tabs[] = array(
     			'title' => $this->language->FIRMWARE,
     			'urlBase' => true,
     			'href' => 'admin/firmware',
     			'protec' => 'ADMINISTRATION_FIRMWARE'
     		);
     
     		$tabs[] = array(
     			'title' => $this->language->OPTIONS,
     			'urlBase' => true,
     			'href' => 'admin/option',
     			'protec' => 'ADMINISTRATION_OPTION'
     		);
     */
     $tabs[] = array('title' => 'Parametros', 'urlBase' => true, 'href' => 'admin/parameter', 'protec' => 'ADMINISTRATION_PARAM');
     /*		Bmonitor 2.5
     		$tabs[] = array(
     			'title' => 'Feature',
     			'urlBase' => true,
     			'href' => 'admin/feature',
     			'protec' => 'ADMINISTRATION_FEATURE'
     		);
     */
     $tps_index_control['tabs'] = $this->bmonitor->getTabs($tabs, 'tabsAdmin');
     $tps_index_control['user_lang'] = $this->language->USER;
     $tps_index_control['groups_lang'] = $this->language->GROUPS;
     $tps_index_control['page_lang'] = $this->language->PAGINA;
     $tps_index_control['audi_lang'] = $this->language->AUDITORIA;
     $tps_index_control['templates_lang'] = $this->language->TEMPLATE_LANG;
     $tps_index_control['parameters_lang'] = $this->language->PARAMETROS;
     $tps_index_control['import_lang'] = $this->language->IMPORT;
     $this->plantilla->set($tps_index_control);
     $this->plantilla->finalize();
 }
示例#17
0
 public function removeSection(Section $section)
 {
     $count = count($this->sections);
     $id = $section->getId();
     for ($i = 0; $i < $count; $i++) {
         if ($this->sections[$i]->getId() === $id) {
             array_splice($this->sections, $i, 1);
             $i--;
             $count--;
         }
     }
     return $this;
 }
 /**
  * @test
  */
 public function shouldReturnAliasNameInGetValuesWhenSet()
 {
     // given
     $section = new Section();
     $section->setWrittenBy(100);
     $section->commit();
     $this->assertEquals(100, $section->getWrittenBy());
     // when
     $values = json_decode($section, true);
     // then
     $this->assertNotNull($values['writtenBy']);
     $this->assertArrayNotHasKey('written_by', $values);
     $this->assertEquals(100, $values['writtenBy']);
 }
示例#19
0
    function nav_sub_section($type,$sort) {
	   $finder= new Section(AMP_Registry::getDbcon());
		if(isset($sort) && $sort){
        	$finder_source = &$finder->getSearchSource();
        	$finder_source->addSort($sort);
		}
    	$sections = $finder->find(array('parent'=>$type,'displayable'=>'1'));
        if (!$sections) return;
        $html = '<ul>';
    	foreach($sections as $section) {
	       		$html .= '<li><a href="section.php?id='.$section->id.'">'.$section->getName().'</a><img src="img/spacer.gif" height="4" width="3" align="left"> </li>'; 
	   }
    	$html .= '</ul>'; 
	   return $html;
    }
function get_sections($con, $args)
{
    $sections = array();
    if (isset($args["section_id"])) {
        $section_id = $args["section_id"];
        $sql = $con->prepare("SELECT section_name,tid,`order` FROM section WHERE section_id=?");
        $sql->bind_param("i", $section_id);
        $sql->bind_result($section_name, $tid, $order);
        $sql->execute();
        $sql->fetch();
        $sql->close();
        if (isset($section_name) && isset($tid) && isset($order)) {
            $tmp = new Section();
            $tmp->populate($section_id, $tid, $section_name, [], $order);
            $sections[] = $tmp->expose();
        }
    } else {
        if (isset($args["section_name"])) {
            $section_name = $args["section_name"];
            $sql = $con->prepare("SELECT section_id,tid,`order` FROM section WHERE section_name=?");
            $sql->bind_param("s", $section_name);
            $sql->bind_result($section_id, $tid, $order);
            $sql->execute();
            while ($sql->fetch()) {
                if (isset($section_id) && isset($tid) && isset($order)) {
                    $tmp = new Section();
                    $tmp->populate($section_id, $tid, $section_name, [], $order);
                    $sections[] = $tmp->expose();
                }
            }
            $sql->close();
        } else {
            $sql = $con->prepare("SELECT section_id,tid,section_name,`order` FROM section");
            $sql->bind_result($section_id, $tid, $section_name, $order);
            $sql->execute();
            while ($sql->fetch()) {
                if (isset($section_id) && isset($tid) && isset($section_name) && isset($order)) {
                    $tmp = new Section();
                    $tmp->populate($section_id, $tid, $section_name, [], $order);
                    $section = $tmp->expose();
                    $sections[] = $section;
                }
            }
            $sql->close();
        }
    }
    return $sections;
}
 /**
  * CMS Fields
  * @return array
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab("Root.Main", array(SortableUploadField::create('Images', 'Current Image(s)')));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
/**
 * Campsite set_section function plugin
 *
 * Type:     function
 * Name:     set_section
 * Purpose:
 *
 * @param array
 *     $p_params[name] The Name of the section to be set
 *     $p_params[number] The Number of the section to be set
 * @param object
 *     $p_smarty The Smarty object
 */
function smarty_function_set_section($p_params, &$p_smarty)
{
    // gets the context variable
    $campsite = $p_smarty->getTemplateVars('gimme');
    if (isset($p_params['number'])) {
        $attrName = 'number';
        $attrValue = $p_params['number'];
        $sectionNumber = intval($p_params['number']);
    } elseif (isset($p_params['name'])) {
        $sections = Section::GetSections($campsite->publication->identifier, $campsite->issue->number, $campsite->language->number, null, $p_params['name']);
        if (isset($sections[0])) {
            $attrName = 'name';
            $attrValue = $p_params['name'];
            $sectionNumber = intval($sections[0]->getSectionNumber());
        } else {
            $campsite->section->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
            return false;
        }
    } else {
        $property = array_shift(array_keys($p_params));
        CampTemplate::singleton()->trigger_error("invalid parameter '{$property}' in set_section");
        return false;
    }
    if ($campsite->section->defined && $campsite->section->number == $sectionNumber) {
        return;
    }
    $sectionObj = new MetaSection($campsite->publication->identifier, $campsite->issue->number, $campsite->language->number, $sectionNumber);
    if ($sectionObj->defined) {
        $campsite->section = $sectionObj;
    }
}
 /**
  * CMS Fields
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab("Root.Main", array(DropdownField::create('FormPageID', 'Select a page', UserDefinedForm::get()->map('ID', 'Title'))));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
示例#24
0
 public function index()
 {
     $valida = $this->protect->access_page('NEUTRALIDAD');
     $this->plantilla->loadSec("neutralidad/neutralidad", $valida, 65333);
     $section = new Section();
     $tps_index_control['menu'] = $section->menu('NEUTRALIDAD');
     $tps_index_control['header'] = $section->header();
     $tps_index_control['footer'] = $section->footer();
     $tps_index_control["NEUTRALITY"] = $this->language->NEUTRALITY;
     $tps_index_control["RESUME"] = $this->language->RESUME;
     $tps_index_control["WEIGHING"] = $this->language->WEIGHING;
     $tps_index_control["EXPORT"] = $this->language->EXPORT;
     $tps_index_control["IMPORT"] = $this->language->IMPORT;
     $this->plantilla->set($tps_index_control);
     $this->plantilla->finalize();
 }
 public function actionView($id)
 {
     $sections = Section::find()->all();
     $model = Section::find()->where(['id' => $id])->one();
     $mips = Mip::find()->where(['section_id' => $id])->all();
     return $this->render('view', ['sections' => $sections, 'model' => $model, 'mips' => $mips]);
 }
示例#26
0
 public function setUp()
 {
     parent::setUp();
     $car = new Car();
     $car->drop()->yesImSure();
     $car->createTable();
     $section = new Section();
     $section->drop()->yesImSure();
     $section->createTable();
     $c = new LudoDBCache();
     $c->drop()->yesImSure();
     $c->createTable();
     $c = new Capital();
     $c->drop()->yesImSure();
     $c->createTable();
 }
示例#27
0
 public function index()
 {
     $name = trim($this->params['name']);
     $parent = $ret = false;
     if ($name == "") {
         $this->notice = "讨论区列表";
         $secs = Configure::read("section");
         foreach ($secs as $k => $v) {
             $ret[] = array("name" => $v[0], "desc" => $v[1], "url" => "/section/" . $k, "hot" => "/hot/" . $k, "dir" => true);
         }
     } else {
         try {
             $sec = Section::getInstance($name, Section::$NORMAL);
             $this->notice = "讨论区-" . $sec->getDesc();
             $brds = $sec->getAll();
             $ret = array();
             foreach ($brds as $b) {
                 $ret[] = array("name" => $b->DESC, "desc" => $b->NAME, "url" => ($b->isDir() ? "/section/" : "/board/") . $b->NAME, "dir" => $b->isDir());
             }
             if ($sec->isRoot()) {
                 $parent = "/section";
             } else {
                 $parent = $sec->getParent();
                 $parent = "/section/" . $parent->getName();
             }
         } catch (SectionNullException $e) {
             $this->error(ECode::$SEC_NOSECTION);
         }
     }
     $this->set("boards", $ret);
     $this->set("parent", $parent);
 }
 /**
  * CMS Fields
  * @var FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab("Root.Main", array(TextareaField::create('Title')->setRows(1), HTMLEditorField::create('Content')));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
示例#29
0
 /** 
  * delete section 
  */
 public function deleteSections()
 {
     //init section class
     $section = new Section();
     //required parameters
     $section->id = $this->_params['id'];
     //delete also IPs and subnets?
     if (isset($this->_params['subnets'])) {
         if ($this->_params['subnets'] == false) {
             $section->subnets = false;
         } else {
             $section->subnets = true;
         }
     } else {
         $section->subnets = true;
     }
     //delete also addresses?
     if ($section->subnets == true) {
         if (isset($this->_params['addresses'])) {
             if ($this->_params['addresses'] == false) {
                 $section->addresses = false;
             } else {
                 $section->addresses = true;
             }
         } else {
             $section->addresses = true;
         }
     }
     //delete section
     $res = $section->deleteSection();
     //return result
     return $res;
 }
 /**
  * Perform initial checks and load requested view
  *
  * @param string $url
  *  URL path of requested view
  */
 public function load($url = null)
 {
     // Check for login
     Controller::instance()->isLoggedIn();
     if (!Controller::instance()->isLoggedIn()) {
         $this->parseURL('/login');
     } else {
         try {
             if (is_null($url)) {
                 // Get user's default section
                 $section_handle = Controller::instance()->User->default_section;
                 // If the section exists, load publish view
                 try {
                     $section = Section::loadFromHandle($section_handle);
                     $this->parseURL('/publish/' . $section_handle);
                 } catch (Exception $e) {
                     $this->parseURL('/blueprints/sections/');
                 }
             } else {
                 $this->parseURL($url);
             }
             // TODO: Fix this
             if (!$this instanceof AdministrationView) {
                 throw new Exception('View not found');
             }
         } catch (Exception $e) {
             throw $e;
             //catch the exception
             print 'Sorry could not load ' . $url;
         }
     }
 }