예제 #1
0
파일: edit.php 프로젝트: raz0rsdge/horde
 */
define('FOLKS_BASE', __DIR__ . '/..');
require_once FOLKS_BASE . '/lib/base.php';
require_once 'tabs.php';
$title = _("Edit my profile");
$profile = $folks_driver->getRawProfile($GLOBALS['registry']->getAuth());
if ($profile instanceof PEAR_Error) {
    $notification->push($profile);
    Folks::getUrlFor('list', 'list')->redirect();
}
$form = new Horde_Form($vars, $title, 'editprofile');
$form->addVariable(_("Email"), 'user_email', 'email', true);
$form->addVariable(_("Birthday"), 'user_birthday', 'monthdayyear', false, false, null, array(date('Y') - 90, date('Y') - 10, '%Y%m%d', '%Y%m%d'));
$form->addVariable(_("Gender"), 'user_gender', 'enum', false, false, null, array(array(1 => _("Male"), 2 => _("Female")), _("--- Select ---")));
$form->addVariable(_("City"), 'user_city', 'text', false);
$v = $form->addVariable(_("Country"), 'user_country', 'enum', false, false, null, array(Folks::getCountries()));
$v->setDefault('SI');
$form->addVariable(_("Homepage"), 'user_url', 'text', false);
if ($registry->hasMethod('video/listVideos')) {
    try {
        $result = $registry->call('video/listVideos', array(array('author' => $GLOBALS['registry']->getAuth()), 0, 100));
        $videos = array();
        foreach ($result as $video_id => $video) {
            $videos[$video_id] = $video['video_title'] . ' - ' . Folks::format_date($video['video_created']);
        }
        $video_link = '<a href="' . $registry->link('video/edit') . '">' . _("Upload a new video") . '</a>';
        $form->addVariable(_("Video"), 'user_video', 'enum', false, false, $video_link, array($videos, _("--- Select ---")));
    } catch (Horde_Exception $e) {
        $notification->push($e);
    }
}