[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/sitemgr/inc/ -> class.NtfMessages_UI.inc.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * eGroupWare SiteMgr - Web Content Management                              *
   4      * http://www.egroupware.org                                                *
   5      * --------------------------------------------                             *
   6      *  This program is free software; you can redistribute it and/or modify it *
   7      *  under the terms of the GNU General Public License as published by the   *
   8      *  Free Software Foundation; either version 2 of the License, or (at your  *
   9      *  option) any later version.                                              *
  10      \**************************************************************************/
  11  
  12      /* $Id: class.NtfMessages_UI.inc.php 20295 2006-02-15 12:31:25Z  $ */
  13  
  14  include_once (EGW_INCLUDE_ROOT . '/sitemgr/inc/class.generic_list_ui.inc.php');
  15  $GLOBALS['egw_info']['flags']['included_classes']['generic_list_ui'] = True;
  16  
  17  define("MAX_STR_LENGTH",200);
  18  
  19  class NtfMessages_UI extends generic_list_ui
  20  {
  21  
  22      var $site_bo;
  23      var $site;
  24  
  25  	function NtfMessages_UI()
  26      {
  27          $common_ui =& CreateObject('sitemgr.Common_UI',True);
  28          $this->bo=CreateObject('sitemgr.NtfMessages_BO');
  29          $this->site=False;
  30          
  31          $this->generic_list_ui('sitemgr', 'NtfMessages_UI', 'sitemgr.notify_messages', 
  32              'sitemgr.notify_messages.edit', 'sitemgr.notify_messages.delete');
  33      }
  34      
  35  	function get_sel_fields($content,$template)
  36      {
  37  
  38          if ($template==$this->edit_template) {
  39               //is site_id defined?
  40              if ($this->limited) {
  41                  $data=$this->bo->get_data();
  42                  if (empty($data)) {
  43                      $res=$this->bo->get_new_message_langs();
  44                      if (empty($res)) {
  45                              $this->list_all('',lang('Messages are defined for all site languages.'));
  46                              exit;
  47                      }
  48                  }
  49                  else
  50                      $res=$this->bo->get_site_langs();
  51              }  
  52              else $res=array();
  53              return(
  54                  array(    // the options for our selectboxes for states
  55                          'language' => $res
  56                  )
  57              );
  58          }
  59          return array();
  60      }
  61  
  62  	function get_readonly_fields($content,$template)
  63      {
  64          if (($template==$this->edit_template)&& isset($content['language'])) {
  65              return array('language'=>True);
  66          }
  67          else if ($template==$this->list_template) {
  68              $res=$this->bo->get_new_message_langs();
  69              $ro=array();
  70              if (empty($res)) {
  71                  $ro+=array('add'=>True);
  72              }
  73              if (!$GLOBALS['Common_BO']->acl->is_admin()){
  74                  $ro+=array('notifications'=>True);
  75              }
  76              return $ro;
  77          }
  78          return array();
  79      }
  80      
  81  	function preprocess_content($content,$template)
  82      {
  83          if ($template==$this->list_template) {
  84              $langs=$this->bo->get_site_langs();
  85              foreach ((array)$content['entry'] as $key => $value) {
  86                  $content['entry'][$key]['language']=$langs[$content['entry'][$key]['language']];
  87                  if (empty($content['entry'][$key]['cat_id'])) {
  88                      if (strlen($content['entry'][$key]['message'])>MAX_STR_LENGTH) {
  89                          $content['entry'][$key]['message']=str_replace(array("\n","\r"),
  90                              " ",substr($content['entry'][$key]['message'],0,197));
  91                          $i=strrpos($content['entry'][$key]['message']," ");
  92                          if (!($i===False)) {
  93                              $content['entry'][$key]['message']=
  94                                  substr($content['entry'][$key]['message'],0,$i);
  95                          }
  96                          $content['entry'][$key]['message']=$content['entry'][$key]['message']."...";
  97                      }
  98                  }
  99              }
 100          }
 101          else if ($template==$this->delete_template) {
 102              $langs=$this->bo->get_site_langs();
 103              $content['language']=$langs[$content['language']];
 104          }
 105          
 106          
 107          return $content;
 108      }
 109  
 110  	function edit_elt($content='',$msg = '')
 111      {
 112          if (isset($content['notifications'])) {
 113              ExecMethod('sitemgr.Notifications_UI.list_all',$content);   
 114          }
 115          else {
 116              parent::edit_elt($content,$msg);
 117          }
 118      }
 119  }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7