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


PHP Avatar::getNobody方法代码示例

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


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

示例1: test_nobody_path

 function test_nobody_path()
 {
     $path = Avatar::getNobody()->getCustomAvatarPath(Avatar::NORMAL);
     $this->assertEquals("/dynamic/user/nobody_normal.png", $path);
 }
开发者ID:ratbird,项目名称:hope,代码行数:5,代码来源:AvatarClassTest.php

示例2: head

function head (&$module, $data, $a) {
    if ($module->config->getValue("Main", "showcontact")
            && $module->config->getValue("Main", "showimage"))
        $colspan = " colspan=\"2\"";
    else
        $colspan = "";

    echo "<tr><td width=\"100%\">\n";
    echo "<table" . $module->config->getAttributes("PersondetailsHeader", "table") . ">\n";
    if (!$module->config->getValue('PersondetailsHeader', 'hidename')) {
        echo "<tr" . $module->config->getAttributes("PersondetailsHeader", "tr") . ">";
        echo "<td$colspan width=\"100%\"";
        echo $module->config->getAttributes("PersondetailsHeader", "headlinetd") . ">";
        echo "<font" . $module->config->getAttributes("PersondetailsHeader", "font") . ">";
        echo $data["fullname"];
        echo "</font></td></tr>\n";
    }

    if ($module->config->getValue("Main", "showimage")
            || $module->config->getValue("Main", "showcontact")) {
        echo "<tr>";
        if ($module->config->getValue("Main", "showcontact")
                && ($module->config->getValue("Main", "showimage") == "right"
                || !$module->config->getValue("Main", "showimage"))) {
                echo "<td" . $module->config->getAttributes("PersondetailsHeader", "contacttd") . ">";
                echo kontakt($module, $data) . "</td>\n";
        }

        if ($module->config->getValue("Main", "showimage")) {
            echo "<td" . $module->config->getAttributes("PersondetailsHeader", "picturetd") . ">";
            echo "<img src=\"".Avatar::getNobody()->getUrl(Avatar::NORMAL)."\" alt=\"Foto " . $data["fullname"] . "\"";
            echo $module->config->getAttributes("PersondetailsHeader", "img") . ">";
        }

        if ($module->config->getValue("Main", "showcontact")
                && $module->config->getValue("Main", "showimage") == "left") {
            echo "<td" . $module->config->getAttributes("PersondetailsHeader", "contacttd") . ">";
            echo kontakt($module, $data) . "</td>\n";
        }

        echo "</tr>\n";
        if ($module->config->getValue('Main', 'showcontact')
                && $module->config->getValue('Contact', 'separatelinks')) {
            echo "<tr><td";
            if ($module->config->getValue('Main', 'showimage'))
                echo ' colspan="2"';
            echo $module->config->getAttributes('PersondetailsHeader', 'contacttd') . ">\n";
            echo kontakt($module, $data, TRUE);
            echo "</td></tr>\n";
        }
    }

    echo "</table>\n</td></tr>\n";
}
开发者ID:ratbird,项目名称:hope,代码行数:54,代码来源:persondetails_preview.inc.php

示例3: comment_action

 /**
  * Writes a comment on a thread and outputs the metadata of new comment as json.
  * @throws AccessDeniedException
  */
 public function comment_action()
 {
     if (!Request::isPost()) {
         throw new Exception("GET not supported");
     }
     $context = Request::option("context");
     $thread = new BlubberPosting(Request::option("thread"));
     if ($thread['context_type'] === "course" && $GLOBALS['SessSemName']['class'] === "sem") {
         $seminar = new Seminar($context);
         if ($seminar->write_level > 0 && !$GLOBALS['perm']->have_studip_perm("autor", $context)) {
             throw new AccessDeniedException();
         }
     }
     BlubberPosting::$course_hashes = $thread['context_type'] === "course" ? $thread['Seminar_id'] : false;
     if (!$thread->isNew() && $thread['Seminar_id'] === $context) {
         $output = array();
         $posting = new BlubberPosting();
         $posting['context_type'] = $thread['context_type'];
         $posting['seminar_id'] = $thread['Seminar_id'];
         $posting['root_id'] = $posting['parent_id'] = $thread->getId();
         $posting['name'] = "Re: " . $thread['name'];
         if ($GLOBALS['user']->id !== "nobody") {
             $posting['user_id'] = $GLOBALS['user']->id;
         } else {
             if (Request::get("anonymous_security") === $_SESSION['blubber_anonymous_security']) {
                 $contact_user = BlubberExternalContact::findByEmail(Request::get("anonymous_email"));
                 $_SESSION['anonymous_email'] = Request::get("anonymous_email");
                 $_SESSION['anonymous_name'] = $contact_user['name'] = Request::get("anonymous_name");
                 $contact_user->store();
                 $posting['user_id'] = $contact_user->getId();
                 $posting['external_contact'] = 1;
             } else {
                 throw new AccessDeniedException("No permission to write posting.");
             }
         }
         $posting['author_host'] = $_SERVER['REMOTE_ADDR'];
         $posting['description'] = studip_utf8decode(Request::get("content"));
         $posting->store();
         BlubberPosting::$mention_posting_id = $posting->getId();
         StudipTransformFormat::addStudipMarkup("mention1", '@\\"[^\\n\\"]*\\"', null, "BlubberPosting::mention");
         StudipTransformFormat::addStudipMarkup("mention2", '@[^\\s]*[\\d\\w_]+', null, "BlubberPosting::mention");
         $content = transformBeforeSave(studip_utf8decode(Request::get("content")));
         $posting['description'] = $content;
         $posting->store();
         $factory = new Flexi_TemplateFactory($this->plugin->getPluginPath() . "/views/streams");
         $template = $factory->open("comment.php");
         $template->set_attribute('posting', $posting);
         $template->set_attribute('course_id', $thread['Seminar_id']);
         $output['content'] = $template->render($template->render());
         $output['mkdate'] = time();
         $output['posting_id'] = $posting->getId();
         //Notifications:
         $user_ids = array();
         if ($thread['user_id'] && $thread['user_id'] !== $GLOBALS['user']->id) {
             $user_ids[] = $thread['user_id'];
         }
         foreach ((array) $thread->getChildren() as $comment) {
             if ($comment['user_id'] && $comment['user_id'] !== $GLOBALS['user']->id && !$comment['external_contact']) {
                 $user_ids[] = $comment['user_id'];
             }
         }
         $user_ids = array_unique($user_ids);
         foreach ($user_ids as $user_id) {
             setTempLanguage($user_id);
             $avatar = Visibility::verify('picture', $GLOBALS['user']->id, $user_id) ? Avatar::getAvatar($GLOBALS['user']->id) : Avatar::getNobody();
             PersonalNotifications::add($user_id, PluginEngine::getURL($this->plugin, array('cid' => $thread['context_type'] === "course" ? $thread['Seminar_id'] : null), "streams/thread/" . $thread->getId()), sprintf(_("%s hat einen Kommentar geschrieben"), get_fullname()), "posting_" . $posting->getId(), $avatar->getURL(Avatar::MEDIUM));
             restoreLanguage();
         }
         $this->render_json($output);
     } else {
         $this->render_json(array('error' => "Konnte thread nicht zuordnen."));
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:77,代码来源:streams.php

示例4: getContent


//.........这里部分代码省略.........
                }
            }


            if ($row !== false) {
                if($aliases_groups[$group_id]) {
                    $content['PERSONS']['GROUP'][$i]['GROUPTITLE-SUBSTITUTE'] = ExternModule::ExtHtmlReady($aliases_groups[$group_id]);
                }
                $content['PERSONS']['GROUP'][$i]['GROUPTITLE'] = ExternModule::ExtHtmlReady($group);
                $content['PERSONS']['GROUP'][$i]['GROUP-NO'] = $i + 1;

                $j = 0;
                do{
                    $visibilities = get_local_visibility_by_id($row['user_id'], 'homepage', true);
                    $user_perm = $visibilities['perms'];
                    $visibilities = json_decode($visibilities['homepage'], true);

                    if ($defaultaddress) {
                        $query = 'SELECT ui.raum, ui.sprechzeiten, ui.Telefon, inst_perms,  Email, ';
                        $query .= 'title_front, title_rear, ';
                        $query .= 'aum.user_id, username, ' . $GLOBALS['_fullname_sql'][$nameformat];
                        $query .= ' AS fullname, aum.Nachname, aum.Vorname FROM auth_user_md5 aum LEFT JOIN ';
                        $query .= 'user_info USING(user_id) LEFT JOIN ';
                        $query .= "user_inst ui USING(user_id) WHERE aum.user_id = '" . $row['user_id'];
                        $query .= "' AND ".get_ext_vis_query().' AND externdefault = 1';

                        $statement2 = DBManager::get()->prepare($query);
                        $statement2->execute();
                        $db_out = $statement2->fetch(PDO::FETCH_ASSOC);
                        //no default
                        if ($db_out === false) {
                            $query = 'SELECT ui.raum, ui.sprechzeiten, ui.Telefon, inst_perms,  Email, ';
                            $query .= 'title_front, title_rear, ';
                            $query .= 'aum.user_id, username, ' . $GLOBALS['_fullname_sql'][$nameformat];
                            $query .= ' AS fullname, aum.Nachname, aum.Vorname FROM auth_user_md5 aum LEFT JOIN ';
                            $query .= 'user_info USING(user_id) LEFT JOIN ';
                            $query .= "user_inst ui USING(user_id) WHERE aum.user_id = '" . $row['user_id'];
                            $query .= "' AND ".get_ext_vis_query()." AND Institut_id = ? " ;
                            $statement2 = DBManager::get()->prepare($query);
                            $params = array($this->config->range_id);
                            $statement2->execute($params);
                            $db_out = $statement2->fetch(PDO::FETCH_ASSOC);
                        }
                    }
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['FULLNAME'] = ExternModule::ExtHtmlReady($db_out['fullname']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['LASTNAME'] = ExternModule::ExtHtmlReady($db_out['Nachname']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['FIRSTNAME'] = ExternModule::ExtHtmlReady($db_out['Vorname']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['TITLEFRONT'] = ExternModule::ExtHtmlReady($db_out['title_front']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['TITLEREAR'] = ExternModule::ExtHtmlReady($db_out['title_rear']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username=' . $db_out['username']));
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['USERNAME'] = $db_out['username'];

                    if (is_element_visible_externally( $row['user_id'], $user_perm, 'picture', $visibilities['picture'])) {
                        $avatar = Avatar::getAvatar($db_out['user_id']);
                    } else {
                        $avatar = Avatar::getNobody();
                    }
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['IMAGE-URL-SMALL'] = $avatar->getURL(Avatar::SMALL);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['IMAGE-URL-MEDIUM'] = $avatar->getURL(Avatar::MEDIUM);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['IMAGE-URL-NORMAL'] = $avatar->getURL(Avatar::NORMAL);

                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['PHONE'] = ExternModule::ExtHtmlReady($db_out['Telefon']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['ROOM'] = ExternModule::ExtHtmlReady($db_out['raum']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL'] = get_visible_email($row['user_id']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL-LOCAL'] = array_shift(explode('@', $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL']));
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL-DOMAIN'] = array_pop(explode('@', $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL']));
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['OFFICEHOURS'] = ExternModule::ExtHtmlReady($db_out['sprechzeiten']);
                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['PERSON-NO'] = $j + 1;

                    // generic data fields
                    if (is_array($generic_datafields)) {
                        $localEntries = DataFieldEntry::getDataFieldEntries($db_out['user_id'], 'user');
                        #$datafields = $datafields_obj->getLocalFields($db_out->f('user_id'));
                        $k = 1;
                        foreach ($generic_datafields as $datafield) {
                            if (isset($localEntries[$datafield]) &&
                                    is_object($localEntries[$datafield] &&
                                    is_element_visible_externally($db_out['user_id'],
                                        $user_perm, $localEntries[$datafield]->getId(),
                                        $visibilities[$localEntries[$datafield]->getId()]))) {
                                if ($localEntries[$datafield]->getType() == 'link') {
                                    $localEntry = ExternModule::extHtmlReady($localEntries[$datafield]->getValue());
                                } else {
                                    $localEntry = $localEntries[$datafield]->getDisplayValue();
                                }
                                if ($localEntry) {
                                    $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['DATAFIELD_' . $k] = $localEntry;
                                }
                            }
                            $k++;
                        }
                    }
                    $j++;
                }while ($row = $statement->fetch(PDO::FETCH_ASSOC));
            }
            $i++;
        }

        return $content;
    }
开发者ID:ratbird,项目名称:hope,代码行数:101,代码来源:ExternModuleTemplatePersons.class.php


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