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


PHP Type::setName方法代码示例

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


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

示例1: findByOwnerAndFilterWithPercents

 /**
  * Metodo que calcula el porcentaje de los tipos de gasto del usuario pasado
  * como parametro en funcion del rango de fechas pasado como parametro.
  * Para realizar el calculo, primero obtiene todos los gastos y la cantidad
  * numerica de gasto que representan. Despues se invoca a un metodo privado
  * para conocer el total de gasto del usuario y se calculan los porcentajes
  * de cada tipo de gasto. Finalmente, se crea un tipo de gasto especial que
  * representa el porcentaje de gasto de aquellos gastos que no tengan ningun
  * tipo de gasto asignado.
  */
 public function findByOwnerAndFilterWithPercents($owner, $startDate, $endDate)
 {
     $stmt = $this->db->prepare("SELECT SUM(s.quantity) as 'spending.quantity',\n                t.idType as 'type.id',\n                t.name as 'type.name'\n        FROM SPENDING s LEFT JOIN TYPE_SPENDING ts  ON s.idSpending = ts.spending LEFT JOIN TYPE t on ts.type = t.idType\n        WHERE s.owner = ?  AND s.dateSpending BETWEEN ? AND ? AND ts.spending IS NOT NULL GROUP BY ts.type");
     $stmt->execute(array($owner, $startDate, $endDate));
     $types_db = $stmt->fetchAll(PDO::FETCH_ASSOC);
     if (sizeof($types_db)) {
         $total = $this->getTotal($owner, $startDate, $endDate);
         $types = [];
         foreach ($types_db as $type_loop) {
             $type = new Type();
             $type->setName($type_loop['type.name']);
             $percent = $type_loop["spending.quantity"] * 100 / $total;
             array_push($types, array("typename" => $type->getName(), "percent" => round($percent, 2), "total" => (double) $type_loop["spending.quantity"]));
         }
         $totalWithoutType = $this->getTotalSpendingsWithoutType($owner, $startDate, $endDate);
         if ($totalWithoutType != 0) {
             $percentSpecialType = $totalWithoutType * 100 / $total;
             $specialType = new Type();
             $specialType->setName("Without category");
             array_push($types, array("typename" => $specialType->getName(), "percent" => round($percentSpecialType, 2), "total" => (double) $totalWithoutType));
         }
         return $types;
     } else {
         return NULL;
     }
 }
开发者ID:adri229,项目名称:wallas,代码行数:36,代码来源:TypeDAO.php

示例2: create

 public function create($data)
 {
     $currentUser = parent::authenticateUser();
     $type = new Type();
     if (!$this->typeDAO->isNewType($data->name)) {
         header($this->server->getServerProtocol() . ' 400 Bad request');
         echo "This type already exits";
         return;
     }
     if (isset($data->name)) {
         $type->setName($data->name);
         $type->setOwner($currentUser->getLogin());
         try {
             $idType = $this->typeDAO->save($type);
             header($this->server->getServerProtocol() . ' 201 Created');
             header($this->server->getRequestUri() . "/" . $idType);
             header('Content-Type: application/json');
         } catch (ValidationException $e) {
             header($this->server->getServerProtocol() . ' 400 Bad request');
             echo json_encode($e->getErrors());
         }
     }
 }
开发者ID:adri229,项目名称:wallas,代码行数:23,代码来源:TypeRest.php

示例3: showEditTypeGeneralRes

 function showEditTypeGeneralRes()
 {
     $displaySysAdmin = new DisplaySysAdmin();
     $survey = new Survey($_SESSION['SUID']);
     $tyd = getFromSessionParams('tyd');
     $content = "";
     if ($tyd != '') {
         //edit
         $type = $survey->getType($tyd);
         $_SESSION['TYD'] = $tyd;
         $content = $displaySysAdmin->displaySuccess(Language::messageTypeChanged(loadvar(SETTING_NAME)));
     } else {
         //add section!
         if (loadvar(SETTING_NAME) != "") {
             $type = new Type();
             $type->setSuid($_SESSION['SUID']);
             $_SESSION['TYD'] = $type->getTyd();
             $content = $displaySysAdmin->displaySuccess(Language::messageTypeAdded(loadvar(SETTING_NAME)));
         }
     }
     $checker = new Checker($_SESSION['SUID']);
     if ($tyd == '') {
         $checks = $checker->checkTypeName(loadvar(SETTING_NAME));
         if (sizeof($checks) > 0) {
             $content = implode("<br/>", $checks);
             return $this->showAddType($content);
         }
     }
     //ADD ALL SORTS OF CHECKS!!
     if ($tyd != '' || loadvar(SETTING_NAME) != "") {
         $type->setName(trim(loadvar(SETTING_NAME)));
         $type->setAnswerType(loadvar(SETTING_ANSWERTYPE));
         $type->setAnswerTypeCustom(loadvar(SETTING_ANSWERTYPE_CUSTOM));
         $type->setOptionsText(loadvarAllowHTML(SETTING_OPTIONS));
         $type->setArray(loadvar(SETTING_ARRAY));
         $type->setKeep(loadvar(SETTING_KEEP));
         $answertype = loadvar(SETTING_ANSWERTYPE);
         if (inArray($answertype, array(ANSWER_TYPE_NONE, ANSWER_TYPE_SECTION))) {
             $type->setHidden(HIDDEN_YES);
         } else {
             $type->setHidden(loadvar(SETTING_HIDDEN));
         }
         if ($type->getInputMask() == "") {
             switch ($answertype) {
                 case ANSWER_TYPE_INTEGER:
                     $type->setInputMask(INPUTMASK_INTEGER);
                     break;
                 case ANSWER_TYPE_DOUBLE:
                     $type->setInputMask(INPUTMASK_DOUBLE);
                     break;
                 case ANSWER_TYPE_RANGE:
                     $type->setInputMask(INPUTMASK_INTEGER);
                     break;
                 default:
                     $type->setInputMask(null);
                     break;
             }
         }
         $type->save();
         $checker = new Checker($_SESSION['SUID']);
         $checks = $checker->checkType($type);
         if (sizeof($checks) > 0) {
             $content .= $displaySysAdmin->displayError(implode("<br/>", $checks));
         }
     }
     /* compile */
     $compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey));
     $mess = $compiler->generateTypes(array($type));
     $vars = $survey->getVariableDescriptivesOfType($tyd);
     $mess = $compiler->generateVariableDescriptives($vars);
     $mess = $compiler->generateGetFills($vars);
     $mess = $compiler->generateInlineFields($vars);
     /* update last page */
     $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
     if ($tyd != '') {
         return $displaySysAdmin->showEditType($_SESSION['TYD'], $content);
     } else {
         return $displaySysAdmin->showSurvey($content);
     }
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:80,代码来源:sysadmin.php

示例4: getData

 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
include "prepend.inc.php";
$Server = getData("Server", "integer");
$User = getData("User");
$Typename = getData("Typename");
$html = "<h1> Database  " . $DB->Name($Server) . " - Type " . $Typename . "</h1>";
if ($Typename) {
    $type = new Type($Server);
    $type->setOwner($User);
    $type->setName($Typename);
    $type->getData();
    $html .= "<table border=0><tr><th>Tag</th><th>Value</th></tr>";
    $html .= "<tr><td>Name</td><td>" . $type->name . "</td></tr>";
    $html .= "<tr><td>Owner</td><td>" . $type->owner . "</td></tr>";
    $html .= "<tr><td>Created</td><td>" . $type->created . "</td></tr>";
    $html .= "<tr><td>Last Modified</td><td>" . $type->lastmodified . "</td></tr>";
    $html .= "<tr><td>Status</td><td>" . $type->status . "</td></tr>";
    $html .= "</table>";
    $html .= "<P><B>Type body:</b><br>";
    $html .= nl2br($type->sql) . "<br>";
    $html .= "</P>";
}
$page = new Page("Type Properties");
$page->setHead();
$page->setBody();
开发者ID:BackupTheBerlios,项目名称:phporacleadmin,代码行数:31,代码来源:type_detail.php


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