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


PHP Evaluation::getNumberChildren方法代码示例

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


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

示例1: createTreeItemDetails

 /**
 * prints out the item details
 *
 * @access  private
 * @param   string   $item_id the current item
 * @return  string   the item details (html)
 */
 function createTreeItemDetails($item_id)
 {
     $mode = $this->getInstance($item_id);
     switch ($mode) {
         case ROOT_BLOCK:
             $eval = new Evaluation($this->evalID, NULL, EVAL_LOAD_FIRST_CHILDREN);
             $hasKids = $eval->getNumberChildren() == 0 ? NO : YES;
             $isLastKid = YES;
             break;
             break;
         case ARRANGMENT_BLOCK:
             $group =& $this->tree->getGroupObject($item_id);
             $hasKids = $group->getNumberChildren() == 0 ? NO : YES;
             $par = $this->getInstance($group->getParentID());
             if ($par == ROOT_BLOCK) {
                 $parent = new Evaluation($group->getParentID(), NULL, EVAL_LOAD_FIRST_CHILDREN);
             } else {
                 $parent =& $this->tree->getGroupObject($group->getParentID());
             }
             $isLastKid = $parent->getNumberChildren() == $group->getPosition() + 1 ? YES : NO;
             break;
         case QUESTION_BLOCK:
             $hasKids = NO;
             $group =& $this->tree->getGroupObject($item_id);
             $par = $this->getInstance($group->getParentID());
             if ($par == ROOT_BLOCK) {
                 $parent = new Evaluation($group->getParentID(), NULL, EVAL_LOAD_FIRST_CHILDREN);
             } else {
                 $parent =& $this->tree->getGroupObject($group->getParentID);
             }
             $isLastKid = $parent->getNumberChildren() == $group->getPosition() + 1 ? YES : NO;
             break;
         default:
             $hasKids = NO;
             $isLastKid = NO;
             break;
     }
     if (!$hasKids || !$this->itemID == $item_id) {
         $level_output = $this->createLevelOutputTD("forumleer.gif") . $level_output;
     } else {
         $level_output = $this->createLevelOutputTD("forumstrich.gif") . $level_output;
     }
     #
     #   if (($isLastKid))
     #       $level_output = $this->createLevelOutputTD ("forumleer.gif") . $level_output;
     #   else
     #       $level_output = $this->createLevelOutputTD ("forumstrich.gif") . $level_output;
     if ($item_id != $this->startItemID) {
         $parent_id = $item_id;
         while ($this->tree->tree_data[$parent_id]['parent_id'] != $this->tree->tree_data[$this->startItemID]['parent_id'] && $this->tree->tree_data[$parent_id]['parent_id'] != $start_itemID && $this->tree->tree_data[$parent_id]['parent_id'] != ROOT_BLOCK) {
             $parent_id = $this->tree->tree_data[$parent_id]['parent_id'];
             #           if (($this->tree->isLastKid($parent_id)) || (!$hasKids))
             #               $level_output = $this->createLevelOutputTD ("forumleer.gif") . $level_output;
             #           else
             #               $level_output = $this->createLevelOutputTD ("forumstrich.gif") . $level_output;
         }
     }
     $table = new HTML("table");
     $table->addAttr("border", "0");
     $table->addAttr("cellspacing", "0");
     $table->addAttr("cellpadding", "0");
     $table->addAttr("width", "100%");
     $tr = new HTML("tr");
     if ($level_output) {
     }
     $tr->addHTMLContent($level_output);
     $td = new HTML("td");
     $td->addAttr("class", "printcontent");
     $td->addAttr("width", "100%");
     $div = new HTML("div");
     $div->addAttr("align", "center");
     $div->setTextareaCheck();
     $div->addHTMLContent($this->getItemContent($item_id));
     $td->addContent($div);
     $tr->addContent($td);
     $table->addContent($tr);
     return $table->createContent();
 }
开发者ID:ratbird,项目名称:hope,代码行数:85,代码来源:EvaluationTreeEditView.class.php

示例2: callSafeguard


//.........这里部分代码省略.........
                 // set new start date
                 if (Request::option("startMode") && !$time_msg) {
                     $eval->setStartDate($startDate);
                     if ($startDate != NULL && $startDate <= time() - 1) {
                         $message .= $message ? "<br>" : " ";
                         $message .= _("Die Evaluation wurde gestartet.");
                     }
                 }
                 // set new stop date
                 if (Request::get("stopMode") && !$time_msg) {
                     $eval->setStopDate($stopDate);
                     $eval->setTimeSpan($timeSpan);
                     if ($stopDate != NULL && $stopDate <= time() - 1 || $timeSpan != NULL && $eval->getStartdate() != NULL && $eval->getStartdate() + $timeSpan <= time() - 1) {
                         $message .= $message ? "<br>" : " ";
                         $message .= _("Die Evaluation wurde beendet.");
                     }
                 }
                 if ($eval->isError()) {
                     $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                     return $safeguard;
                 }
                 $eval->save();
             }
             $evalChanged = YES;
             // start/endtime aren't saved, because of ranges with no permisson
             if ($time_msg) {
                 $safeguard .= $this->createSafeguard("ausruf", $time_msg);
             }
             // everything is just fine so print the all messages
             if ($update_message && !$time_msg) {
                 $safeguard .= $this->createSafeguard("ok", $update_message . "<br>" . $message);
             } elseif ($time_msg && $message) {
                 $safeguard .= $this->createSafeguard("ok", $message);
             }
             break;
         case "search_showrange":
         case "search_range":
             $search = Request::get("search");
             if (EvaluationObjectDB::getGlobalPerm(YES) < 31) {
                 $safeguard = $this->createSafeguard("ausruf", _("Sie besitzen keine Berechtigung eine Suche durchzuführen."));
                 return $safeguard;
             }
             $results = $evalDB->search_range($search);
             if (empty($search)) {
                 $safeguard .= $this->createSafeguard("ausruf", _("Bitte einen Suchbegriff eingeben."), $search);
             } elseif (sizeof($results) == 0) {
                 $safeguard .= $this->createSafeguard("ausruf", sprintf(_("Es wurde kein Bereich gefunden, der den Suchbegriff <b>%s</b> enthält."), htmlReady($search)), $search);
             } else {
                 $safeguard .= $this->createSafeguard("ok", sprintf(_("Es wurden %s Bereiche gefunden, die den Suchbegriff <b>%s</b> enthalten."), sizeof($results), htmlReady($search)), $search);
             }
             break;
         case "check_abort_creation":
             # check if the evaluation is new and not yet edited
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN);
             $abort_creation = false;
             if ($eval->getTitle() == _("Neue Evaluation") && $eval->getText() == "") {
                 # the evaluationen may be not edited yet ... so continue checking
                 $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
                 $number_of_childs = $eval->getNumberChildren();
                 $child = $eval->getNextChild();
                 if ($number_of_childs == 1 && $child && $child->getTitle() == _("Erster Gruppierungsblock") && $child->getChildren() == NULL && $child->getText() == "") {
                     $abort_creation = true;
                 }
             }
             if ($abort_creation != true) {
                 break;
             }
             # continue abort_creation
         # continue abort_creation
         case "abort_creation":
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $eval->delete();
             // error_ausgabe
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", _("Die Erstellung einer Evaluation wurde abgebrochen."), "", "", "", $referer);
             break;
         case "nothing":
             break;
         default:
             $safeguard .= $this->createSafeguard("ausruf", _("Fehler! Es wurde versucht, eine nicht vorhandene Aktion auszuführen."));
             break;
     }
     /* Send SMS when eval has been modified by admin/root ----------------- */
     if ($evalChanged && $eval->getAuthorID() != $auth->auth["uid"]) {
         $sms = new messaging();
         $sms->insert_message(sprintf(_("An Ihrer Evaluation \"%s\" wurden von %s Änderungen vorgenommen."), $eval->getTitle(), get_username($auth->auth["uid"])), get_username($eval->getAuthorID()), "____%system%____", FALSE, FALSE, "1");
     }
     /* ------------------------------------------------------ end: send SMS */
     // the current range has been removed from the eval
     if ($current_range_removed) {
         $return["msg"] = $safeguard;
         $return["option"] = DISCARD_OPENID;
         return $return;
     } else {
         return $safeguard;
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:101,代码来源:evaluation_admin_overview.lib.php


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