當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ca_occurrences::getTypeName方法代碼示例

本文整理匯總了PHP中ca_occurrences::getTypeName方法的典型用法代碼示例。如果您正苦於以下問題:PHP ca_occurrences::getTypeName方法的具體用法?PHP ca_occurrences::getTypeName怎麽用?PHP ca_occurrences::getTypeName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ca_occurrences的用法示例。


在下文中一共展示了ca_occurrences::getTypeName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Full

 public function Full()
 {
     $t_lists = new ca_lists();
     $t_list_items = new ca_list_items();
     $o_purifier = new HTMLPurifier();
     $pn_occurrence_id = $this->request->getParameter('occurrence_id', pString);
     $t_occurrence = new ca_occurrences($pn_occurrence_id);
     $va_access_values = caGetUserAccessValues($this->request);
     $va_occ_info[] = "<b>" . _t("Lesson type") . "</b>: " . $t_occurrence->getTypeName();
     $va_occ_info2 = array();
     foreach (array("gradelevel", "lessonTopic", "learning_standard", "commonCore", "skills", "EdProject", "funder") as $vs_attribute_code) {
         if ($va_values = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertCodesToDisplayText" => false, "returnAsArray" => true))) {
             $va_output_parts = array();
             foreach ($va_values as $k => $va_value) {
                 if ($va_value[$vs_attribute_code]) {
                     # --- display hierarchy path for "lessonTopic", "learning_standard", "commonCore"
                     if (in_array($vs_attribute_code, array("lessonTopic", "learning_standard", "commonCore"))) {
                         $vs_tmp = "";
                         $va_hierarchy_ancestors = $t_list_items->getHierarchyAncestors($va_value[$vs_attribute_code], array("idsOnly" => true, "includeSelf" => true));
                         if (is_array($va_hierarchy_ancestors) && sizeof($va_hierarchy_ancestors)) {
                             # --- remove the root - we don't want to display it
                             $va_root = array_pop($va_hierarchy_ancestors);
                             if (is_array($va_hierarchy_ancestors) && sizeof($va_hierarchy_ancestors)) {
                                 foreach ($va_hierarchy_ancestors as $vni => $vn_list_item_id) {
                                     $vs_tmp = $t_lists->getItemForDisplayByItemID($vn_list_item_id) . ($vni > 0 ? " > " . $vs_tmp : "");
                                 }
                                 $va_output_parts[] = $vs_tmp;
                             }
                         }
                     } else {
                         $vs_value = "";
                         if ($vs_value = trim($va_value[$vs_attribute_code])) {
                             $va_output_parts[] = $t_lists->getItemForDisplayByItemID($vs_value);
                         }
                     }
                 }
             }
             if (sizeof($va_output_parts)) {
                 $va_occ_info[$vs_attribute_code] = "<b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b>: " . join(", ", $va_output_parts);
             }
         }
     }
     $va_occ_info["HR"] = "<HR>";
     $va_attributes = array("theme", "guidelines", "sure", "directions", "context", "task", "glossary", "instructions", "essay", "essential", "check");
     foreach ($va_attributes as $vs_attribute_code) {
         if ($vs_value = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>"))) {
             if ($vs_attribute_code == "glossary") {
                 $va_glossary_terms = array();
                 $va_values = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "returnAsArray" => true));
                 foreach ($va_values as $va_value) {
                     $va_glossary_terms[] = $va_value["glossary"];
                 }
                 sort($va_glossary_terms);
                 $vs_value = implode("<br/>", $va_glossary_terms);
                 $va_occ_info[$vs_attribute_code] = "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><br/>" . $vs_value . "</div><!-- end unit -->";
             } else {
                 $va_occ_info[$vs_attribute_code] = "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><br/>" . str_replace("*", "&bull; ", $vs_value) . "</div><!-- end unit -->";
             }
         }
     }
     $va_attributes = array("questions", "challenge", "connections", "resources", "transcription", "translation", "essay");
     foreach ($va_attributes as $vs_attribute_code) {
         if ($vs_value = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>"))) {
             if (in_array($vs_attribute_code, array("questions", "resources"))) {
                 $va_values = $t_occurrence->get("ca_occurrences.{$vs_attribute_code}", array("convertLineBreaks" => true, "delimiter" => "<br/>", "returnAsArray" => true));
                 $vs_tmp = "";
                 $vs_tmp .= "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><ol>";
                 foreach ($va_values as $va_value_info) {
                     $vs_tmp .= "<li>" . $va_value_info[$vs_attribute_code] . "</li>";
                 }
                 $vs_tmp .= "</ol></div><!-- end unit -->";
                 $va_occ_info2[$vs_attribute_code] = $vs_tmp;
             } else {
                 $va_occ_info2[$vs_attribute_code] = "<div class='unit'><b>" . $t_occurrence->getDisplayLabel("ca_occurrences.{$vs_attribute_code}") . "</b><br/>" . str_replace("*", "&bull; ", $vs_value) . "</div><!-- end unit -->";
             }
         }
     }
     # --- related objects
     $va_related_objects_links = $t_occurrence->get("ca_objects_x_occurrences.relation_id", array("returnAsArray" => true));
     $va_related_objects_info = array();
     if (sizeof($va_related_objects_links)) {
         $t_objects_x_occurrences = new ca_objects_x_occurrences();
         foreach ($va_related_objects_links as $vn_relation_id) {
             $va_object_info = array();
             $t_objects_x_occurrences->load($vn_relation_id);
             $va_reps = $t_objects_x_occurrences->get("ca_objects_x_occurrences.representation_list", array("returnAsArray" => true, 'idsOnly' => true));
             $va_reps_info = array();
             if (is_array($va_reps)) {
                 foreach ($va_reps as $vn_relation_id => $va_attr) {
                     $t_rep = new ca_object_representations($va_attr['representation_list']);
                     $va_media_info = $t_rep->getMediaInfo('media');
                     $vn_height = $va_media_info["large"]["HEIGHT"];
                     $vn_width = $va_media_info["large"]["WIDTH"];
                     if ($vn_height > 900) {
                         $vn_new_width = 900 * $vn_width / $vn_height;
                         $va_reps_info[] = "<img src='" . $t_rep->getMediaUrl('media', 'large') . "' style='height:900px; width:" . $vn_new_width . "px;'>";
                     } else {
                         $va_reps_info[] = $t_rep->getMediaTag('media', 'large');
                     }
                 }
//.........這裏部分代碼省略.........
開發者ID:guaykuru,項目名稱:pawtucket,代碼行數:101,代碼來源:DownloadController.php


注:本文中的ca_occurrences::getTypeName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。