当前位置: 首页>>代码示例>>PHP>>正文


PHP Rights::check_rights方法代码示例

本文整理汇总了PHP中Rights::check_rights方法的典型用法代码示例。如果您正苦于以下问题:PHP Rights::check_rights方法的具体用法?PHP Rights::check_rights怎么用?PHP Rights::check_rights使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rights的用法示例。


在下文中一共展示了Rights::check_rights方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  * delete deletes the given entry
  * 
  * @param int $cid entry-id for calendar
  * @return string html-string
  */
 private function delete($cid)
 {
     // pagecaption
     $this->tpl->assign('pagecaption', parent::lang('class.CalendarView#page#caption#delete') . ": {$cid}");
     // check rights
     if (Rights::check_rights($cid, 'calendar')) {
         // prepare return
         $output = '';
         // smarty-templates
         $sConfirmation = new JudoIntranetSmarty();
         $form = new HTML_QuickForm2('confirm', 'post', array('name' => 'confirm', 'action' => 'calendar.php?id=delete&cid=' . $this->get('cid')));
         // add button
         $form->addElement('submit', 'yes', array('value' => parent::lang('class.CalendarView#delete#form#yes')));
         // smarty-link
         $link = array('params' => '', 'href' => 'calendar.php?id=listall', 'title' => parent::lang('class.CalendarView#delete#title#cancel'), 'content' => parent::lang('class.CalendarView#delete#form#cancel'));
         $sConfirmation->assign('link', $link);
         $sConfirmation->assign('spanparams', 'id="cancel"');
         $sConfirmation->assign('message', parent::lang('class.CalendarView#delete#message#confirm'));
         $sConfirmation->assign('form', $form);
         // validate
         if ($form->validate()) {
             // get calendar-object
             $calendar = new Calendar($cid);
             // disable entry
             $calendar->update(array('valid' => 0));
             // smarty
             $sConfirmation->assign('message', parent::lang('class.CalendarView#delete#message#done'));
             $sConfirmation->assign('form', '');
             // write entry
             try {
                 $calendar->write_db('update');
             } catch (Exception $e) {
                 $GLOBALS['Error']->handle_error($e);
                 return $GLOBALS['Error']->to_html($e);
             }
         }
         // smarty return
         return $sConfirmation->fetch('smarty.confirmation.tpl');
     } else {
         // error
         $errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id'));
         $GLOBALS['Error']->handle_error($errno);
         return $GLOBALS['Error']->to_html($errno);
     }
 }
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:51,代码来源:class.CalendarView.php

示例2: decisions

 /**
  * decissions shows the decissions of this or all protocols
  * 
  * @param int $pid entry-id for protocol
  * @return string html of the decissions page
  */
 private function decisions($pid)
 {
     // pagecaption
     $this->tpl->assign('pagecaption', parent::lang('class.ProtocolView#page#caption#decisions'));
     // check rights
     if (Rights::check_rights($pid, 'protocol', true) || $pid == false) {
         // prepare template
         $sD = new JudoIntranetSmarty();
         // check pid all or single
         if ($pid === false) {
             // get protocol ids
             $pids = Protocol::return_protocols();
             // create protocol objects to sort
             $protocols = array();
             foreach ($pids as $pid) {
                 $protocols[] = new Protocol($pid);
             }
             // sort array by protocols date
             usort($protocols, array($this, 'callback_compare_protocols'));
             // walk through ids
             $counter = 0;
             foreach ($protocols as $protocol) {
                 // assign data
                 $data[$counter] = array('date' => $protocol->get_date('d.m.Y'), 'type' => $protocol->get_type(), 'location' => $protocol->get_location(), 'decisions' => $this->parseHtml($protocol->get_protocol(), '<p class="tmceDecision">|</p>'));
                 // check if protocol has decisions
                 if (count($data[$counter]['decisions']) == 0) {
                     unset($data[$counter]);
                 }
                 $data = array_merge($data);
                 // add to template
                 $sD->assign('data', $data);
                 // increment counter
                 $counter++;
             }
         } else {
             // get protocol object
             $protocol = new Protocol($pid);
             // assign data
             $data[] = array('date' => $protocol->get_date('d.m.Y'), 'type' => $protocol->get_type(), 'location' => $protocol->get_location(), 'decisions' => $this->parseHtml($protocol->get_protocol(), '<p class="tmceDecision">|</p>'));
             // add to template
             $sD->assign('data', $data);
         }
         // return
         return $sD->fetch('smarty.protocol.showdecisions.tpl');
     } else {
         // error
         $errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id'));
         $GLOBALS['Error']->handle_error($errno);
         return $GLOBALS['Error']->to_html($errno);
     }
 }
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:57,代码来源:class.ProtocolView.php

示例3: delete

 /**
  * delete deletes the given entry
  * 
  * @param int $cid entry-id for calendar
  * @return string html-string
  */
 private function delete()
 {
     // check rights
     if (Rights::check_rights($this->get('cid'), 'calendar')) {
         // check cid and pid given
         if ($this->get('cid') !== false && $this->get('pid') !== false) {
             // check cid and pid exists
             if (Calendar::check_id($this->get('cid')) && Preset::check_preset($this->get('pid'), 'calendar')) {
                 // pagecaption
                 $this->tpl->assign('pagecaption', parent::lang('class.AnnouncementView#page#caption#delete'));
                 // prepare return
                 $return = '';
                 // smarty-templates
                 $sConfirmation = new JudoIntranetSmarty();
                 $form = new HTML_QuickForm2('confirm', 'post', array('name' => 'confirm', 'action' => 'announcement.php?id=delete&cid=' . $this->get('cid') . '&pid=' . $this->get('pid')));
                 // add button
                 $form->addElement('submit', 'yes', array('value' => parent::lang('class.AnnouncementView#delete#form#yes')));
                 // smarty-link
                 $link = array('params' => '', 'href' => 'calendar.php?id=listall', 'title' => parent::lang('class.AnnouncementView#delete#title#cancel'), 'content' => parent::lang('class.AnnouncementView#delete#form#cancel'));
                 $sConfirmation->assign('link', $link);
                 $sConfirmation->assign('spanparams', 'id="cancel"');
                 $sConfirmation->assign('message', parent::lang('class.AnnouncementView#delete#message#confirm'));
                 $sConfirmation->assign('form', $form);
                 // validate
                 if ($form->validate()) {
                     // get calendar-object
                     $calendar = new Calendar($this->get('cid'));
                     // get preset
                     $preset = new Preset($this->get('pid'), 'calendar', $this->get('cid'));
                     // get fields
                     $fields = $preset->get_fields();
                     // delete values of the fields
                     if (Calendar::check_ann_value($calendar->get_id(), $calendar->get_preset_id()) === true) {
                         foreach ($fields as $field) {
                             // delete value
                             $field->delete_value();
                         }
                     }
                     // set preset to 0
                     $calendar->update(array('preset_id' => 0));
                     // smarty
                     $sConfirmation->assign('message', parent::lang('class.AnnouncementView#delete#message#done'));
                     $sConfirmation->assign('form', '');
                     // write entry
                     try {
                         $calendar->write_db('update');
                     } catch (Exception $e) {
                         $GLOBALS['Error']->handle_error($e);
                         $output = $GLOBALS['Error']->to_html($e);
                     }
                 }
                 // smarty return
                 return $sConfirmation->fetch('smarty.confirmation.tpl');
             } else {
                 // error
                 $errno = $GLOBALS['Error']->error_raised('WrongParams', 'entry:cid_or_pid', 'cid_or_pid');
                 $GLOBALS['Error']->handle_error($errno);
                 return $GLOBALS['Error']->to_html($errno);
             }
         } else {
             // error
             $errno = $GLOBALS['Error']->error_raised('MissingParams', 'entry:cid_or_pid', 'cid_or_pid');
             $GLOBALS['Error']->handle_error($errno);
             return $GLOBALS['Error']->to_html($errno);
         }
     } else {
         // error
         $errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id'));
         $GLOBALS['Error']->handle_error($errno);
         return $GLOBALS['Error']->to_html($errno);
     }
 }
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:78,代码来源:class.AnnouncementView.php

示例4: movement

 /**
  * movement returns the details of a movement-entry as html
  * 
  * @param int $mid entry-id for the movement
  * @return string html-string with the details of the movement entry
  */
 private function movement($mid)
 {
     // get db-object
     $db = Db::newDb();
     // get movement details
     // prepare sql-statement
     $sql = "SELECT m.inventory_id\n\t\t\t\tFROM inventory_movement AS m\n\t\t\t\tWHERE m.id = {$mid}";
     // execute
     $result = $db->query($sql);
     // fetch result
     list($inventory_id) = $result->fetch_array(MYSQL_NUM);
     // get invetory-object
     $inventory = new Inventory($inventory_id);
     // get preset
     $preset = $inventory->get_preset();
     // get fields
     $fields = $preset->get_fields();
     // check rights
     if (Rights::check_rights($inventory->get_id(), 'inventory')) {
         //smarty-template
         $sM = new JudoIntranetSmarty();
         // prepare sql
         $sql = "SELECT m.id,m.user_id,m.action,m.date_time\n\t\t\t\t\tFROM inventory_movement AS m\n\t\t\t\t\tWHERE m.inventory_id=" . $inventory->get_id() . "\n\t\t\t\t\tORDER BY m.date_time ASC";
         // execute
         $result = $db->query($sql);
         // fetch result
         $i = 0;
         $movements_data = array();
         while (list($m_id, $m_user_id, $m_action, $m_date_time) = $result->fetch_array(MYSQL_NUM)) {
             $movements_data[$i]['id'] = $m_id;
             $movements_data[$i]['user_id'] = $m_user_id;
             $movements_data[$i]['action'] = $m_action;
             $movements_data[$i]['date_time'] = $m_date_time;
             $i++;
         }
         // get actual movement data
         $data = array();
         for ($i = 0; $i < count($movements_data); $i++) {
             // check actual mid and previous
             if ($movements_data[$i]['id'] == $mid) {
                 $data[0]['id'] = $movements_data[$i]['id'];
                 $data[0]['user_id'] = $movements_data[$i]['user_id'];
                 $data[0]['action'] = $movements_data[$i]['action'];
                 $data[0]['date_time'] = $movements_data[$i]['date_time'];
                 // check first
                 if ($i != 0) {
                     $data[1]['id'] = $movements_data[$i - 1]['id'];
                     $data[1]['user_id'] = $movements_data[$i - 2]['user_id'];
                     $data[1]['action'] = $movements_data[$i - 1]['action'];
                 }
             }
         }
         $sM->assign('inventory', parent::lang('class.InventoryView#movement#hx#movement') . $inventory->get_name() . ' (' . $inventory->get_inventory_no() . ')');
         $sM->assign('date', parent::lang('class.InventoryView#movement#hx#at') . date('d.m.Y', strtotime($data[0]['date_time'])));
         $back = array('href' => 'javascript:history.back(1)', 'title' => parent::lang('class.InventoryView#movement#back#title'), 'content' => parent::lang('class.InventoryView#movement#back#name'));
         $sM->assign('back', $back);
         foreach ($data as $movement) {
             // get user
             $user = new User();
             $user->change_user($movement['user_id'], false, 'id');
             // prepare fields
             $fields_out = array();
             foreach ($fields as $field) {
                 // get values
                 $data = array('table' => 'inventory_movement', 'table_id' => $movement['id'], 'field_id' => $field->get_id());
                 $field->read_value($data);
                 $fields_out[] = $field->value_to_html();
             }
             $sM->assign('data', $fields_out);
             $sM->assign('user', parent::lang('class.InventoryView#movement#fields#' . $movement['action']) . ' ' . $user->get_userinfo('name'));
         }
         // return
         return $sM->fetch('smarty.inventory.movement.tpl');
     } else {
         // error
         $errno = $GLOBALS['Error']->error_raised('NotAuthorized', $this->get('id'), $mid);
         $GLOBALS['Error']->handle_error($errno);
         return $GLOBALS['Error']->to_html($errno);
     }
 }
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:86,代码来源:class.InventoryView.php


注:本文中的Rights::check_rights方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。