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


PHP Message::getInstance方法代码示例

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


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

示例1: __construct

 /**
  * @param Entity $entity_1
  * @param Entity $entity_2
  * @param string $name
  * @property $name nome della tabella sul db
  * @param null $roleName1
  * @param null $roleName2
  */
 function __construct($entity_1, $entity_2, $name = "", $roleName1 = null, $roleName2 = null)
 {
     $this->entity_1 = $entity_1;
     $this->entity_2 = $entity_2;
     if (!$this->entity_1->name) {
         echo Message::getInstance()->getMessage(MSG_ERROR_UNKNOWN_ENTITY) . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
         exit;
     }
     if (isset($roleName1)) {
         $this->roleName1 = $roleName1;
     } else {
         $this->roleName1 = $this->entity_1->fields[0]->name . "_" . $this->entity_1->entityName;
     }
     if (isset($roleName2)) {
         $this->roleName2 = $roleName2;
     } else {
         $this->roleName2 = $this->entity_2->fields[0]->name . "_" . $this->entity_2->entityName;
     }
     if ($name != "") {
         parent::__construct(DB::getInstance(), "{$name}");
     } else {
         parent::__construct(DB::getInstance(), "{$this->entity_1->entityName}_{$this->entity_2->entityName}");
     }
     /**
      *
      *Relations do not have any primary key.
      *
      */
     $this->addReference($this->entity_1, $this->roleName1);
     $this->addReference($this->entity_2, $this->roleName2);
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:39,代码来源:Relation.php

示例2: save

 public function save($values_condition)
 {
     if (Settings::getOperativeMode() == 'debug') {
         echo '<br /> save File to folder';
         var_dump($values_condition);
     }
     $values_condition["owner"] = $_SESSION["user"]["username"];
     if (isset($values_condition['file'])) {
         $values_condition['filetype'] = $values_condition['file']['type'];
         $values_condition['size'] = $values_condition['file']['size'];
         $values_condition['filename'] = 'upload/' . $values_condition['file']['name'];
         if (file_exists("upload/" . $values_condition["file"]["name"])) {
             echo Message::getInstance()->getMessage(MSG_ERROR_FILE_EXIST) . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
         } else {
             move_uploaded_file($values_condition["file"]["tmp_name"], $values_condition["filename"]);
         }
     }
     unset($values_condition['file']);
     return parent::save($values_condition);
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:20,代码来源:entityFileToFolder.php

示例3: updateTables

 function updateTables()
 {
     $result = mysql_query("SHOW TABLES FROM {$this->name}");
     while ($row = mysql_fetch_row($result)) {
         $this->tables[] = strtolower($row[0]);
     }
     if (Settings::getModMode()) {
         foreach ($this->tables as $k => $tableName) {
             $oid = mysql_query("SHOW COLUMNS\n\t\t\t\t\t\tFROM {$tableName}");
             if (!$oid) {
                 echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_GENERIC) . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
                 exit;
             }
             do {
                 $data = mysql_fetch_assoc($oid);
                 if ($data) {
                     $this->fields[$tableName][$data['Field']] = true;
                 }
             } while ($data);
         }
     }
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:22,代码来源:db.php

示例4: report2

 function report2($name, $data, $pars)
 {
     $content = "<div class=\"report\">\n";
     $heading = true;
     if (count($data) > 0 and $data != '') {
         $content .= "<table cellspacing=0>\n";
         foreach ($data as $k => $v) {
             if ($heading) {
                 $heading = false;
                 $content .= "<tr id=\"heading\">\n";
                 foreach ($v as $k1 => $v1) {
                     $content .= "<th>{$k1}</th>";
                 }
             }
             /*
             $content .= "<tr class=\"datarow\" onClick=\"my_jump('value','{$v['value']}');\">\n";
             */
             $content .= "<tr onMouseOver=\"my_mouseOver(this);\"\r\n\t\t\t\t              onMouseOut=\"my_mouseOut(this);\"\r\n\t\t\t\t              onClick=\"my_jump('value','{$v['value']}');\">\n";
             foreach ($v as $k1 => $v1) {
                 if ($k1 == "text") {
                     $v1 = substr($v1, 0, 50);
                 }
                 $content .= "<td>{$v1}</td>";
             }
             $keys = array_keys($v);
             $keyName = $keys[0];
             $keyValue = $v[$keyName];
             #$content .= "<td><a href=\"".basename($_SERVER['SCRIPT_NAME'])."?page=1&{$keyName}={$keyValue}\">edit</a></td>\n";
             $content .= "</tr>\n";
         }
         $content .= "</table>\n";
     } else {
         $content .= Message::getInstance()->getMessage(MSG_REPORT_EMPTY);
     }
     $content .= "</div>\n";
     return $content;
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:37,代码来源:report.inc.php

示例5: getNewMessages

 /**
  * Get all new chat messages for this table.
  *
  * @param int $timestamp The timestamp after which to look for new messages.
  */
 public static function getNewMessages($timestamp, $id)
 {
     $db = new DB();
     $sql = "SELECT m.idmessage\n                  FROM messages AS m\n            INNER JOIN poker_tables AS pt ON pt.idtable = m.idrecvr AND pt.idtable = '" . $id . "'\n                 WHERE UNIX_TIMESTAMP(m.created) > '" . $timestamp . "'\n                   AND m.recvr = 'poker'\n              ORDER BY m.idmessage ASC";
     $result = $db->query($sql);
     if ($result->length() > 0) {
         $msgs = array();
         do {
             $msgs[] = Message::getInstance($result->idmessage);
         } while ($result->next());
         return $msgs;
     }
     return false;
 }
开发者ID:anhvn,项目名称:pokerspot,代码行数:19,代码来源:poker_table.class.php

示例6: build

 /**
  * 
  * (non-PHPdoc)
  * @see FormWidget::build()
  * @access public
  * @param v
  * @param preload
  * @ParamType v 
  * @ParamType preload 
  */
 public function build($preload)
 {
     $content .= "    <td valign=\"TOP\"></td>\n";
     switch ($v['orientation']) {
         case RIGHT:
             $mainEntity = $this->form->entity->entity_1;
             $secondaryEntity = $this->form->entity->entity_2;
             break;
         case LEFT:
             $mainEntity =& $this->form->entity->entity_2;
             $secondaryEntity =& $this->form->entity->entity_1;
             break;
     }
     //setto i valori necessari in caso di gestione degli Rss
     if ($this->form->mainFormEntity->rss) {
         $query1 = "SELECT bc_channel.title FROM bc_channel\n\t\t\t\t\tLEFT JOIN channel_entity\n\t\t\t\t\tON bc_channel.id=channel_entity.id_bc_channel\n\t\t\t\t\tWHERE entity=\"{$this->form->mainFormEntity->name}\"";
         $listChannel = Parser::getResultArray($query1, 'title');
         if (!is_array($listChannel)) {
             $listChannel = array();
         }
         $cont = count($listChannel);
         $query1 = "SELECT modality FROM bc_rss_mod WHERE entity=\"{$this->form->mainFormEntity->name}\"";
         $rssMod = Parser::getResultArray($query1, 'modality');
     }
     /* this fetches all the item which should be put into checkboxes */
     $data = $secondaryEntity->getReferenceWithCondition($v['condition']);
     $content .= "<td>\n";
     #print_r($_REQUEST);
     #echo "<hr>";
     if ($this->form->entity->entity_2->owner and $v['orientation'] == RIGHT or $this->form->entity->entity_1->owner and $v['orientation'] == LEFT) {
         $your = Message::getInstance()->getMessage(FIELDSET);
     } else {
         $your = "";
     }
     $id = uniqid(time());
     if ($preload) {
         $content .= "<fieldset><legend>{$your} {$v["label"]}</legend>\n";
         if ($this->form->description != "") {
             $content .= "{$this->form->description}<br/><br/>\n";
         }
         $content .= "<table width=\"90%\">";
         $counter = 0;
         if (count($data) > 0 and $data != "") {
             $first = true;
             $c = 0;
             foreach ($data as $key => $value) {
                 $counter++;
                 if (isset($_REQUEST["{$v['name']}_{$value['value']}"])) {
                     if ($this->form->mainFormEntity->rss) {
                         if (in_array($value['text'], $listChannel)) {
                             switch ($rssMod[0]) {
                                 case MOD3:
                                     $content .= " <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\" CHECKED> {$value['text']}<br>\n";
                                     break;
                                 case MOD2:
                                     $c++;
                                     if ($first) {
                                         $first = false;
                                         $content .= " <input id=\"0\"class=\"clear\" type=\"checkbox\" name=\"rss_mod2\" value=\"0\" onClick=\"reload({$cont});\" CHECKED> " . Message::getInstance()->getMessage(RSS_MODALITY2_MSG) . "\n";
                                     }
                                     $content .= " <input id=\"{$c}\" style=\"display : none\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\" CHECKED>\n";
                                     break;
                                 case MOD1:
                                     $content .= " <input style=\"display : none\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\" CHECKED>\n";
                                     if ($first) {
                                         $content .= Message::getInstance()->getMessage(RSS_MODALITY1_MSG);
                                         $first = false;
                                     }
                                     break;
                             }
                         }
                     } else {
                         if ($counter % 2 == 1) {
                             $content .= Parser::first_comma($id, "</td></tr>");
                             $content .= "<tr><td>";
                         } else {
                             $content .= "</td><td>";
                         }
                         $name = "{$v['name']}_" . Parser::encode_name($value['value']);
                         $content .= " <input class=\"\" type=\"checkbox\" name=\"{$name}\" value=\"{$value['value']}\" CHECKED> {$value['text']}\n";
                     }
                 } else {
                     if ($this->form->mainFormEntity->rss) {
                         if (in_array($value['text'], $listChannel)) {
                             switch ($rssMod[0]) {
                                 case MOD3:
                                     $content .= " <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_{$value['value']}\" value=\"{$value['value']}\"> {$value['text']}<br>\n";
                                     break;
                                 case MOD2:
                                     $c++;
//.........这里部分代码省略.........
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:101,代码来源:TwoColumnsRelManagerField.php

示例7: getResult

 static function getResult($query, $mode = "NORMAL")
 {
     switch ($mode) {
         case ADVANCED:
         case PARSE:
             $finito = false;
             do {
                 if (ereg("\\[([[:alnum:]]*)\\]", $query, $token)) {
                     $query = ereg_replace("\\[{$token[1]}\\]", $_REQUEST[$token[1]], $query);
                 } else {
                     $finito = true;
                 }
             } while (!$finito);
             break;
         default:
             break;
     }
     if ($mode == PARSE) {
         return $query;
     } else {
         $oid = mysql_query($query);
         if (!$oid) {
             echo mysql_error();
             echo "<hr>", $query;
             exit;
             echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_GENERIC);
             exit;
         }
         do {
             $data = mysql_fetch_assoc($oid);
             if ($data) {
                 foreach ($data as $k => $v) {
                     if (is_string($data[$k])) {
                         $data[$k] = stripslashes($v);
                     }
                 }
                 $content[] = $data;
             }
         } while ($data);
         if (!isset($content)) {
             $content = "";
         }
         return $content;
     }
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:45,代码来源:parser.inc.php

示例8: getForm

 /**
  * generate form: new message
  *
  * @return string html code for the form
  * @author Elias Müller
  **/
 private function getForm()
 {
     $tpl = new Template('message');
     $el = $this->s->element != '' ? $this->s->element : false;
     switch ($this->s->action) {
         case 'update':
             $m = Message::getInstance($this->s->element);
             break;
         case 'reply':
             $r = Message::getInstance($this->s->element);
             $m = new Message();
             $m->subject = 'Re: ' . $r->subject;
             $m->receiver = $r->sender === $this->s->user ? $r->receiver : $r->sender;
             if ($r->replyto != 0) {
                 $el = $r->replyto;
             }
             break;
     }
     $tpl->assign('message', $m);
     $tpl->assign('action', $this->s->action);
     $tpl->assign('id', $el);
     $tpl->assign('user', User::getActiveUsers());
     return $tpl->fetch('form_message.html');
 }
开发者ID:anhvn,项目名称:pokerspot,代码行数:30,代码来源:backend.class.php

示例9: __construct

	public function __construct() {
		parent::__construct();
		
		//$this->shoppingCar = new shoppingCar();
        $this->messages = Message::getInstance();
	}
开发者ID:rinox,项目名称:Project-management,代码行数:6,代码来源:appcontroller.php

示例10: getUnread

 /**
  * get all unread messages for one user
  *
  * @return array
  * @author Elias Müller
  **/
 public static function getUnread()
 {
     $s = cBootstrap::getInstance();
     $db = new DB();
     $messages = array();
     $sql = "SELECT m.idmessage\n\t\t\t\t  FROM messages AS m\n\t\t\t\t WHERE m.iduser = " . $s->user->id . "\n\t\t\t\t   AND m.read = 0\n\t\t\t\t   AND m.recvr = 'user'\n\t\t\t  ORDER BY m.idmessage DESC";
     $result = $db->query($sql);
     if ($result->length() > 0) {
         do {
             $messages[$result->idmessage] = Message::getInstance($result->idmessage);
         } while ($result->next());
     }
     return $messages;
 }
开发者ID:anhvn,项目名称:pokerspot,代码行数:20,代码来源:message.class.php

示例11: lista

 function lista($name, $data, $pars)
 {
     $x = 0;
     while ($x < count($data)) {
         $content .= "<table>";
         $content .= "<tr>";
         $content .= "<td colspan=2 style=\"padding-top: 20px;\" valign=\"top\">{$data[$x][0][$pars['field']]}</td>\n";
         $content .= "<td colspan=2 style=\"padding-top: 20px;\"><table>\n";
         if (is_array($data[$x])) {
             foreach ($data[$x] as $i => $v) {
                 $content .= "  <tr>  <td style=\"padding-left: 10px;\">\n";
                 $content .= "<input class='clear' type=\"checkbox\" name=\"check_-{$v[$pars['field']]}_-{$v[$pars['name']]}\" value=\"{$v[$pars['value']]}\"";
                 if ($v[$pars['checked']] == 1) {
                     $content .= "CHECKED";
                 }
                 $content .= "></td><td> {$v[$pars['text']]}&nbsp;&nbsp;";
                 $content .= "</td>\n";
                 $content .= "</tr>\n";
             }
         }
         $content .= "</table>\n";
         $content .= "</td>\n";
         $content .= "</tr>\n";
         $content .= "<tr>\n";
         $content .= "<td colspan=2 style=\"padding-top: 20px;\" valign=\"top\">Modality</td>\n";
         $content .= "<td>\n";
         $content .= "<table>\n";
         $message = Message::getInstance()->getMessage(MODALITY1);
         $content .= "<tr>\n";
         $content .= "<td style=\"padding-left: 10px; padding-top: 20px;\">\n";
         if ($data[$x][0][$pars['mod']] == MOD1) {
             $content .= "<input type=\"radio\" name=\"MOD_-{$data[$x][0][$pars['field']]}\" value=\"MOD1\" CHECKED> </td><td style=\"padding-top: 20px;\">{$message}</td>\n";
         } else {
             $content .= "<input type=\"radio\" name=\"MOD_-{$data[$x][0][$pars['field']]}\" value=\"MOD1\"></td><td style=\"padding-top: 20px;\"> {$message}</td>\n";
         }
         $content .= "</tr>\n";
         $message = Message::getInstance()->getMessage(MODALITY2);
         $content .= "<tr>\n";
         $content .= "<td style=\"padding-left: 10px;\">\n";
         if ($data[$x][0][$pars['mod']] == MOD2) {
             $content .= "<input type=\"radio\" name=\"MOD_-{$data[$x][0][$pars['field']]}\" value=\"MOD2\" CHECKED> </td><td>{$message}</td>\n";
         } else {
             $content .= "<input type=\"radio\" name=\"MOD_-{$data[$x][0][$pars['field']]}\" value=\"MOD2\"></td><td> {$message}</td>\n";
         }
         $content .= "</tr>\n";
         $message = Message::getInstance()->getMessage(MODALITY3);
         $content .= "<tr>\n";
         $content .= "<td style=\"padding-left: 10px;\">\n";
         if ($data[$x][0][$pars['mod']] == MOD3) {
             $content .= "<input type=\"radio\" name=\"MOD_-{$data[$x][0][$pars['field']]}\" value=\"MOD3\" CHECKED></td><td> {$message}</td>\n";
         } else {
             $content .= "<input type=\"radio\" name=\"MOD_-{$data[$x][0][$pars['field']]}\" value=\"MOD3\"></td><td> {$message}</td>\n";
         }
         $content .= "</tr>\n";
         $content .= "</table>\n";
         $content .= "</td>\n</tr>\n</table>\n";
         $content .= "<br>";
         $x++;
     }
     return $content;
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:61,代码来源:formTag.inc.php

示例12: emitHTML

 function emitHTML($operation, $page, $preload)
 {
     $content = "";
     if (!$this->triggered) {
         $this->setContent("formName", $this->name);
         $this->setContent("formMethod", $this->method);
         $this->setContent("formPage", $page);
         switch ($operation) {
             case ADD:
                 $session_id_name = "S_" . md5($this->entity->name);
                 $session_id = md5(microtime());
                 $_SESSION[$session_id_name] = $session_id;
                 $actionHeader = '<input type="hidden" name="' . $session_id_name . '" value="' . $session_id . '" />';
                 $actionHeader = '<input type="hidden" name="action" value="add" />';
                 break;
             case EDIT:
                 if (!isset($_REQUEST[$this->entity->fields[0]->name])) {
                     $_REQUEST[$this->entity->fields[0]->name] = $_REQUEST["value"];
                 }
                 $actionHeader .= '<input type="hidden" name="' . $this->entity->fields[0]->name . '" value="' . $_REQUEST[$this->entity->fields[0]->name] . '" />';
                 $actionHeader .= '<input type="hidden" name="value" value="' . $_REQUEST[$this->entity->fields[0]->name] . '"/>';
                 if (!$this->moderationMode) {
                     $actionHeader .= '<input type="hidden" name="action" value="edit" />';
                 } else {
                     $actionHeader .= '<input type="hidden" name="action" value="validate" />';
                 }
                 if ($this->entity->owner) {
                     $actionHeader .= '<input type="hidden" name="username" value="' . $_REQUEST['username'] . '" />';
                 }
                 break;
         }
         $this->setContent("actionHeader", $actionHeader);
     }
     /**
      * Setting value for the hidden value input ( the id of the considered entity
      */
     if (isset($_REQUEST["value"])) {
         $this->setContent("value", $_REQUEST["value"]);
     } else {
         $this->setContent("value", 0);
     }
     /**
      * Building and emitting widgets
      */
     foreach ($this->elements as $k => $v) {
         $content .= '';
         $content .= $v->build($preload);
         $content .= '';
     }
     /**
      * Building and emitting html for triggered forms
      */
     if (count($this->triggeredForms) > 0 and $this->triggeredForms != "") {
         foreach ($this->triggeredForms as $k => $form) {
             $content .= $form->emitHTML($operation, $page, $preload);
         }
     }
     /**
      * if this is not a triggered form emit the closing for the form
      * including add and edit buttons
      */
     if (!$this->triggered) {
         $closing .= '<div class="clear"></div><div class="closing">';
         switch ($operation) {
             case "add":
                 if (isset($subcontent)) {
                     $closing .= $subcontent;
                     if (!isset($this->labels[EDIT])) {
                         $label = Message::getInstance()->getMessage(BUTTON_EDIT);
                     } else {
                         $label = $this->labels[EDIT];
                     }
                     $closing .= '<input type="submit" value="' . $label . '" />';
                 } else {
                     if (!isset($this->labels[ADD])) {
                         $label = Message::getInstance()->getMessage(BUTTON_ADD);
                     } else {
                         $label = $this->labels[ADD];
                     }
                     $closing .= '<input type="submit" value="' . $label . '" />';
                     $closing .= '<input type="reset" value="Azzera i campi" />';
                 }
                 break;
             case "edit":
                 if (!$this->moderationMode) {
                     $closing .= '<input type="submit" value="' . Message::getInstance()->getMessage(BUTTON_EDIT) . '" />';
                     //onClick=\"submit_{$this->name}();\">";
                     /* if (!$this->noDelete) {
                     
                     						$this->noDelete = false;
                     
                     						if (isset($this->labels[DELETE])) {
                     							$label = Message::getInstance()->getMessage(BUTTON_EDIT);
                     						} else {
                     							$label = $this->labels[DELETE];
                     						}
                     
                     						$closing .= '<input class="ml10" type="button" value="'.Message::getInstance()->getMessage(BUTTON_DELETE).'" onClick="deleteThis('.$_REQUEST['value'].'");" />';
                     					} */
                 } else {
//.........这里部分代码省略.........
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:101,代码来源:Form.php

示例13: __construct

	public function __construct() {
		parent::__construct();

		
                $this->messages = Message::getInstance();
	}
开发者ID:rinox,项目名称:Project-management,代码行数:6,代码来源:appviews.php

示例14: insertItem

 /**
  * @access public
  */
 public function insertItem()
 {
     if ($this->debugmode) {
         echo "<br> Entity::insertItem for {$this->name} instance";
     }
     /**
      * called only from logs
      */
     $id = md5(uniqid(mt_rand()));
     $query = "INSERT INTO {$this->name} VALUES(";
     $args = func_get_args();
     if (is_array($args[0])) {
         foreach ($this->fields as $k => $field) {
             switch ($field->type) {
                 case FILE:
                     $query .= Parser::first_comma("{$id}", ", ") . "'{$args[0][$field->name]}'";
                     $query .= Parser::first_comma("{$id}", ", ") . "'" . $args[0][$field->name . "_filename"] . "'";
                     $query .= Parser::first_comma("{$id}", ", ") . "'" . $args[0][$field->name . "_size"] . "'";
                     $query .= Parser::first_comma("{$id}", ", ") . "'" . $args[0][$field->name . "_type"] . "'";
                     break;
                 default:
                     $query .= Parser::first_comma("{$id}", ", ") . "'{$args[0][$field->name]}'";
                     break;
             }
         }
     } else {
         foreach ($args as $k => $field) {
             $query .= Parser::first_comma("{$id}", ", ") . "'{$field}'";
         }
     }
     $query .= ")";
     $oid = mysql_query($query);
     if (!$oid) {
         if (mysql_errno() != "1062") {
             if (mysql_errno() == "1136") {
                 echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_INIT) . " {$this->name} " . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
                 exit;
             }
         } else {
             echo Message::getInstance()->getMessage(MSG_ERROR_DATABASE_PRESENTATION) . " {$this->name} " . " (" . basename(__FILE__) . ":" . __LINE__ . ")";
             exit;
         }
     }
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:47,代码来源:Entity.php

示例15: build

 /**
  * @access public
  * @param preload
  * @ParamType preload string
  */
 public function build($preload)
 {
     /**
      * retrieving the field that has the same name of the graphic element that we're creating
      */
     //$field_to_modify = $this->form->entity->getField($v['name']);
     $field_to_modify = $this->form->entity->getField($this->name);
     /**
      * Observation, this time the field is a file so four fields are involved in the operation,
      * for this reason four variables must be initialized
      */
     $field_to_modify_type = $this->form->entity->getField($v['name'] . "_type");
     $field_to_modify_filename = $this->form->entity->getField($v['name'] . "_filename");
     $field_to_modify_reference = $this->form->entity->getField($v['name'] . "_reference");
     if (Settings::getOperativeMode() == 'debug') {
         echo '<br />debug in File Field widgets ';
         echo '<br />field to modify ';
         var_dump($field_to_modify);
         echo '<br />field to modify type ';
         var_dump($field_to_modify_type);
         echo '<br />field to modify filename ';
         var_dump($field_to_modify_filename);
         echo '<br />field to modify reference ';
         var_dump($field_to_modify_reference);
         echo '<br />preload ';
         var_dump($preload);
         echo '<br />$v ';
         var_dump($v);
     }
     if ($preload) {
         if (isset($this->form->helpers[$v['name']])) {
             $content .= "    <td>{$v["label"]} <a href=# title=\"{$this->form->helpers[$v['name']]}\"><img src=\"img/form/help.gif\" class=\"helper\"></a> </td>\n";
         } else {
             $label = $v['label'];
             //$content .= '<label>'.$v["label"].'</label>';
         }
         $name = $v['name'];
         $value = $field_to_modify_filename;
         //input hidden name + value
         //$content .= "<input class=\"inl_blks cells mb20\" type=\"file\" name=\"{$v['name']}\"/>
         //              <input type=\"hidden\" name=\"{$v['name']}_hidden\" value=\"{$field_to_modify_filename}\" />\n";
         if ($_REQUEST[$v['name']]) {
             switch ($field_to_modify_type) {
                 case "image/jpeg":
                 case "image/gif":
                     /* IMAGE */
                     $content .= " <div class=\"image-show\" id=\"{$v['name']}\" >\n\n\t\t\t\t\t\t                <input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled />\n\t\t\t\t\t\t                <img src=\"img/beContent/show-gray.jpg\" onClick=\"image_show('{$v['name']}')\">\n\t\t\t\t\t\t                <div id=\"{$v['name']}_img\">";
                     $content .= "<span>" . $field_to_modify_type . "</span><br />\n<img class=\"left\" src=\"show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}&width=188\">\n</div>\n</div>";
                     $content .= "&nbsp; <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_delete\" value=\"*\"> " . Message::getInstance()->getMessage(MSG_FILE_DELETE);
                     break;
                 case "video/x-flv":
                 case "application/octet-stream":
                     /*
                     FLASH VIDEO FLV
                     The extension should be checked since anything can be
                     uploaded here.
                     */
                     $content .= " <div class=\"image-show\" id=\"{$v['name']}\" >\n<input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled /><img src=\"img/beContent/show-gray.jpg\" onClick=\"image_show('{$v['name']}')\">\n<div id=\"{$v['name']}_img\">\n";
                     $src = "show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}";
                     $width = 200;
                     $height = 150;
                     $content .= "<script type=\"text/javascript\">\nAC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','{$width}','height','{$height}','id','FLVPlayer2','src','FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','FLVPlayer_Progressive' );\n</script>\n<noscript>\n<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"{$width}\" height=\"{$height}\" id=\"FLVPlayer2\">\n<param name=\"movie\" value=\"FLVPlayer_Progressive.swf\" />\n<param name=\"salign\" value=\"lt\" />\n<param name=\"scale\" value=\"noscale\" />\n<param name=\"FlashVars\" value=\"&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false\" />\n<embed src=\"FLVPlayer_Progressive.swf\" flashvars=\"&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false\"  scale=\"noscale\" width=\"{$width}\" height=\"{$height}\" name=\"FLVPlayer\" salign=\"LT\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" />\n</object>\n</noscript>\n";
                     $content .= "</div>\n";
                     break;
                 default:
                     /* UNKNOWN MIME TYPE */
                     $content .= " <div class=\"image-show\" id=\"{$v['name']}\" ><input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled /><a target=\"_blank\" title=\"{$field_to_modify_filename}\" href=\"show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}\"><img src=\"img/beContent/show-gray-link.jpg\"></a></div>";
                     $content .= "<input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_delete\" value=\"*\"> " . Message::getInstance()->getMessage(MSG_FILE_DELETE);
                     break;
             }
             $content .= "\n";
         } else {
             /* EMPTY */
             $content .= " <div class=\"image-show\" ><input type=\"text\" class=\"file\" value=\"" . Message::getInstance()->getMessage(MSG_FILE_NONE) . "\" disabled /><img src=\"img/beContent/show-gray-disabled.jpg\"></div> </td>\n";
             #$content .= "(".Message::getInstance()->getMessage(MSG_FILE_NONE).") </td>\n";
         }
     } else {
         if (isset($this->form->helpers[$v['name']])) {
             $content .= "    <td>{$v["label"]} <a href=# title=\"{$this->form->helpers[$v['name']]}\"><img src=\"img/form/help.gif\" class=\"helper\"></a> </td>\n";
         } else {
             echo $label = $v['label'];
             //$content .= '<label>'.$v["label"].'</label>';
         }
         //$this->name = $v['name'];
         //$content .= '<input type="file" name="'.$v['name'].'" />';
     }
     $widget = new Skinlet("widget/FileField");
     $widget->setContent("label", $this->label);
     $widget->setContent("name", $this->name);
     $widget->setContent('value', $value);
     $widget->setContent("loggedUsername", $_SESSION["user"]["username"]);
     $widget->setContent("preloadedImageId", $preloadedId);
     return $widget->get();
 }
开发者ID:patriziopezzilli,项目名称:Fusion,代码行数:99,代码来源:FileField.php


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