public function toCSV()
 {
     $output = $this->gatherPermissions();
     $sep = get_csv_separator();
     $date = util_timestamp_to_userdateformat($_SERVER['REQUEST_TIME'], true);
     $filename = 'export_permissions_' . $this->group->getUnixName() . '_' . $date . '.csv';
     header('Content-Disposition: filename=' . $filename);
     header('Content-Type: text/csv');
     // Context
     echo $GLOBALS['Language']->getText('plugin_docman', 'format_export_project') . $sep . tocsv($this->group->getPublicName(), $sep) . $sep . tocsv($this->group->getUnixName(), $sep) . $sep . $this->group->getId() . PHP_EOL;
     echo $GLOBALS['Language']->getText('plugin_docman', 'format_export_date') . $sep . format_date(util_get_user_preferences_export_datefmt(), $_SERVER['REQUEST_TIME']) . PHP_EOL;
     echo PHP_EOL;
     // Datas
     echo $GLOBALS['Language']->getText('plugin_docman', 'format_id') . $sep;
     echo $GLOBALS['Language']->getText('plugin_docman', 'format_path') . $sep;
     echo $GLOBALS['Language']->getText('plugin_docman', 'format_type') . $sep;
     foreach ($this->getUgroups() as $id => $name) {
         echo $name . $sep;
     }
     echo PHP_EOL;
     foreach ($output as $itemid => $row) {
         echo $itemid . $sep;
         echo tocsv($row['title'], $sep) . $sep;
         echo $this->itemTypeToString($row['type']) . $sep;
         foreach ($this->getUgroups() as $id => $name) {
             if (isset($row[$id])) {
                 $this->itemPermToString($row[$id]);
             }
             echo $sep;
         }
         echo PHP_EOL;
     }
 }
 function getContent()
 {
     $html = '';
     $dwItemFactory = $this->getDocmanWatermarkItemFactory();
     $watermarkingIsDisabled = $dwItemFactory->isWatermarkingDisabled($this->item->getId());
     // Status
     if ($watermarkingIsDisabled) {
         $status = '<strong>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_disabled') . '</strong>';
     } else {
         $status = $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_enabled');
     }
     $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_status', array($status)) . '</p>';
     // About section
     $html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_about_title') . '</h2>';
     $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_disclamer_pdf') . '</p>';
     // Disable/enable section
     $user = $this->getUserManager()->getCurrentUser();
     $dPm = $this->getDocman_PermissionsManager($this->item->getGroupId());
     if ($dPm->userCanManage($user, $this->item->getId())) {
         $html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_toggle_title') . '</h2>';
         $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_desc') . '</p>';
         $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_clicktoproceed') . '</p>';
         $html .= '<form method="post" action="' . $this->url . '&item_id=' . $this->item->getId() . '&action=docmanwatermark_toggle_item">';
         if ($watermarkingIsDisabled) {
             $html .= '<input type="submit" name="enable_watermarking" value="' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_enableit') . '" />';
         } else {
             $html .= '<input type="submit" name="disable_watermarking" value="' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_disableit') . '" />';
         }
         $html .= '</form>';
     }
     // History
     $html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_title') . '</h2>';
     $dwLog = $this->getDocmanWatermark_Log();
     $dar = $dwLog->getLog($this->item);
     if ($dar && $dar->rowCount() > 0) {
         $uh = UserHelper::instance();
         $hp = Codendi_HTMLPurifier::instance();
         $titles = array($GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_when'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_who'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_what'));
         $html .= html_build_list_table_top($titles, false, false, false);
         $altColor = 0;
         foreach ($dar as $logEntry) {
             $html .= '<tr class="' . html_get_alt_row_color($altColor++) . '">';
             $html .= '<td>' . util_timestamp_to_userdateformat($logEntry['time']) . '</td>';
             $html .= '<td>' . $hp->purify($uh->getDisplayNameFromUserId($logEntry['who'])) . '</td>';
             $html .= '<td>' . ($logEntry['watermarked'] == 0 ? $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_desactivate') : $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_activate')) . '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
        <fieldset>
            <legend style="font-size:1.3em; font-weight: bold;"><?php 
        echo $row_grp['group_name'];
        ?>
</legend>
        
<?php 
        $group = $pm->getProject($row_grp['group_id']);
        $currentproject = $pm->getProject($row_grp['group_id']);
        $members_id = $group->getMembersId();
        if (count($members_id) > 0) {
            $admin_id = $members_id[0];
            // the first (and normally the only one) is the project creator)
            $admin = UserManager::instance()->getUserById($admin_id);
            if ($admin->getID() != 0) {
                $project_date_creation = util_timestamp_to_userdateformat($group->getStartDate());
                // Display the project admin (the project creator) and the creation date
                echo $Language->getText('admin_approve_pending', 'creator_and_creation_date', array($admin->getID(), $admin->getName(), $project_date_creation));
            }
        }
        ?>
    
        <p>
        <A href="/admin/groupedit.php?group_id=<?php 
        echo $row_grp['group_id'];
        ?>
"><b><?php 
        echo $Language->getText('admin_groupedit', 'proj_edit');
        ?>
</b></A> | 
        <A href="/project/admin/?group_id=<?php 
Exemple #4
0
                }
                $GLOBALS['Response']->redirect('/news/admin');
            }
        }
        news_header(array('title' => $Language->getText('news_admin_index', 'title')));
        if ($request->get('approve')) {
            /*
            	Show the submit form
            */
            $sql = "SELECT groups.unix_group_name,news_bytes.* " . "FROM news_bytes,groups WHERE id=" . db_ei($id) . " " . "AND news_bytes.group_id=groups.group_id ";
            $result = db_query($sql);
            if (db_numrows($result) < 1) {
                exit_error($Language->getText('global', 'error'), $Language->getText('news_admin_index', 'not_found_err'));
            }
            $username = user_getname(db_result($result, 0, 'submitted_by'));
            $news_date = util_timestamp_to_userdateformat(db_result($result, 0, 'date'), true);
            echo '
		<H3>' . $Language->getText('news_admin_index', 'approve') . '</H3>
		<P>
		<FORM ACTION="" METHOD="POST">
		<INPUT TYPE="HIDDEN" NAME="for_group" VALUE="' . db_result($result, 0, 'group_id') . '">
		<INPUT TYPE="HIDDEN" NAME="id" VALUE="' . db_result($result, 0, 'id') . '">
		<B>' . $Language->getText('news_admin_index', 'submitted_for_group') . ':</B> <a href="/projects/' . strtolower(db_result($result, 0, 'unix_group_name')) . '/">' . $pm->getProject(db_result($result, 0, 'group_id'))->getPublicName() . '</a><BR>
		<B>' . $Language->getText('news_admin_index', 'submitted_by') . ':</B> <a href="/users/' . $username . '">' . $username . '</a><BR>
        <B>' . $Language->getText('news_admin_index', 'submitted_on') . ':</B> ' . $news_date . '<BR>        
		<INPUT TYPE="HIDDEN" NAME="approve" VALUE="y">
		<INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y">
		<INPUT TYPE="RADIO" NAME="status" VALUE="1"> ' . $Language->getText('news_admin_index', 'approve_for_front') . '<BR>
		<INPUT TYPE="RADIO" NAME="status" VALUE="0"> ' . $Language->getText('news_admin_index', 'do_nothing') . '<BR>
		<INPUT TYPE="RADIO" NAME="status" VALUE="2" CHECKED> ' . $Language->getText('news_admin_index', 'reject') . '<BR>
		<B>' . $Language->getText('news_admin_index', 'subject') . ':</B><BR>
 /**
  * Returns the artifact followup for mail rendering
  *
  * @param array  $recipient
  * @param string $format, the mail format text or html
  * @param bool   $ignore_perms, indicates if we ignore various permissions
  *
  * @return String
  */
 public function fetchMailFollowUp($recipient, $format, $ignore_perms = false)
 {
     $uh = UserHelper::instance();
     $um = UserManager::instance();
     $cs = $this->getChangesets();
     $hp = Codendi_HTMLPurifier::instance();
     $output = '';
     if ($format == 'html') {
         $output .= '<tr>
             <td colspan="3" align="left">
                 <h2>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'follow_ups') . '
                 </h2>
             </td>
         </tr>';
     }
     foreach ($cs as $changeset) {
         $comment = $changeset->getComment();
         /* @var $comment Tracker_Artifact_Changeset_Comment */
         if (empty($comment) || $comment->hasEmptyBody()) {
             //do not display empty comment
             continue;
         }
         switch ($format) {
             case 'html':
                 $followup = $comment->fetchMailFollowUp($format);
                 $output .= $followup;
                 break;
             case 'text':
                 $user = $um->getUserById($comment->submitted_by);
                 $output .= PHP_EOL;
                 $output .= '----------------------------- ';
                 $output .= PHP_EOL;
                 $output .= $GLOBALS['Language']->getText('plugin_tracker_artifact', 'mail_followup_date') . util_timestamp_to_userdateformat($comment->submitted_on);
                 $output .= "\t" . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'mail_followup_by') . $uh->getDisplayNameFromUser($user);
                 $output .= PHP_EOL;
                 $output .= $comment->getPurifiedBodyForText();
                 $output .= PHP_EOL;
                 $output .= PHP_EOL;
                 break;
             default:
                 $output .= '<!-- TODO -->';
                 break;
         }
     }
     return $output;
 }
 function getTableHistory()
 {
     $html = '';
     $uh = UserHelper::instance();
     if (is_a($this->table, 'Docman_ApprovalTableVersionned')) {
         $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_title') . '</h3>';
         $html .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_version'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_owner'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_status'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_date')));
         $allTables = $this->atf->getAllApprovalTable();
         $rowColorIdx = 1;
         foreach ($allTables as $table) {
             $html .= '<tr class="' . html_get_alt_row_color($rowColorIdx++) . '">';
             if ($this->table->getVersionNumber() != $table->getVersionNumber()) {
                 $url = Docman_View_View::buildUrl($this->url, array('action' => 'details', 'section' => 'approval', 'id' => $this->item->getId(), 'version' => $table->getVersionNumber()));
                 $href = '<a href="' . $url . '">' . $table->getVersionNumber() . '</a>';
             } else {
                 $href = $table->getVersionNumber();
             }
             $html .= '<td>' . $href . '</td>';
             $html .= '<td>' . $this->hp->purify($uh->getDisplayNameFromUserId($table->getOwner())) . '</td>';
             $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'approval_review_state_' . $table->getApprovalState()) . '</td>';
             $html .= '<td>' . util_timestamp_to_userdateformat($table->getDate()) . '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
 function getValue()
 {
     $v = $this->md->getValue();
     switch ($v) {
         case PLUGIN_DOCMAN_ITEM_VALIDITY_PERMANENT:
             return $GLOBALS['Language']->getText('plugin_docman', 'md_html_validity_permanent');
             break;
         default:
             return util_timestamp_to_userdateformat($v, true);
     }
 }
 /**
  * Returns the artifact followup for mail rendering
  *
  * @param array  $recipient
  * @param string $format, the mail format text or html
  * @param bool   $ignore_perms, indicates if we ignore various permissions
  *
  * @return String
  */
 public function fetchMailFollowUp($recipient, $format, $ignore_perms = false)
 {
     $uh = UserHelper::instance();
     $um = UserManager::instance();
     $cs = $this->getChangesets();
     $hp = Codendi_HTMLPurifier::instance();
     $output = '';
     foreach ($cs as $changeset) {
         $comment = $changeset->getComment();
         $changes = $changeset->diffToPrevious($format, $recipient, $ignore_perms);
         if (empty($comment)) {
             //do not display empty comment
             continue;
         }
         switch ($format) {
             case 'html':
                 $followup = $comment->fetchFollowUp($format, true);
                 if (!empty($followup)) {
                     if (!isset($output)) {
                         $output = '<h2>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'follow_ups') . '</h2>';
                     }
                     $output .= '<div class="tracker_artifact_followup_header">';
                     $output .= $followup;
                     $output .= '</div>';
                 }
                 break;
             case 'text':
                 $user = $um->getUserById($comment->submitted_by);
                 $output .= PHP_EOL;
                 $output .= '----------------------------- ';
                 $output .= PHP_EOL;
                 $output .= $GLOBALS['Language']->getText('plugin_tracker_artifact', 'mail_followup_date') . util_timestamp_to_userdateformat($comment->submitted_on);
                 $output .= "\t" . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'mail_followup_by') . $uh->getDisplayNameFromUser($user);
                 $output .= PHP_EOL;
                 $output .= $comment->getPurifiedBodyForText();
                 $output .= PHP_EOL;
                 $output .= PHP_EOL;
                 break;
             default:
                 $output .= '<!-- TODO -->';
                 break;
         }
     }
     return $output;
 }
 function _icon($icon, $params = NULL)
 {
     // returns the HTML to display the named icon
     global $Language;
     switch ($icon) {
         case 'main':
             $src = $this->getThemePath() . "/images/project_link.png";
             $height = 21;
             $width = 77;
             $alt = $Language->getText('plugin_plinks', 'project_links');
             break;
         case 'add':
             $src = $this->getThemePath() . "/images/add.png";
             $height = 10;
             $width = 10;
             $alt = $Language->getText('plugin_plinks', 'add');
             break;
         case 'template':
             $src = $this->getThemePath() . "/images/template.png";
             $height = 15;
             $width = 10;
             $alt = $Language->getText('plugin_plinks', 'template_marker');
             break;
         case 'new':
             $src = $this->getThemePath() . "/images/new.png";
             $height = 10;
             $width = 10;
             $alt = $Language->getText('plugin_plinks', 'newly_added', util_timestamp_to_userdateformat($params['date']));
             break;
         case 'arrow-right':
             $src = $this->getThemePath() . "/images/arrow-right.png";
             $height = 10;
             $width = 10;
             $alt = "";
             break;
         case 'trash':
             $src = util_get_image_theme('ic/trash.png');
             $height = 16;
             $width = 16;
             $alt = $Language->getText('plugin_plinks', 'delete');
             break;
         case 'matched':
             $src = util_get_image_theme('ic/check.png');
             $height = 15;
             $width = 16;
             $alt = $Language->getText('plugin_plinks', 'matched');
             break;
     }
     return "<IMG SRC='{$src}' HEIGHT='{$height}' WIDTH='{$width}' BORDER='0'\n            ALT='{$alt}' TITLE='{$alt}'>";
 }
Exemple #10
0
function plugin_forumml_show_all_threads($p, $list_id, $list_name, $offset)
{
    $chunks = 30;
    $request =& HTTPRequest::instance();
    // all threads
    $sql = 'SELECT SQL_CALC_FOUND_ROWS m.id_message, m.last_thread_update, mh_d.value as date, mh_f.value as sender, mh_s.value as subject' . ' FROM plugin_forumml_message m' . ' LEFT JOIN plugin_forumml_messageheader mh_d ON (mh_d.id_message = m.id_message AND mh_d.id_header = ' . FORUMML_DATE . ')' . ' LEFT JOIN plugin_forumml_messageheader mh_f ON (mh_f.id_message = m.id_message AND mh_f.id_header = ' . FORUMML_FROM . ') ' . ' LEFT JOIN plugin_forumml_messageheader mh_s ON (mh_s.id_message = m.id_message AND mh_s.id_header = ' . FORUMML_SUBJECT . ') ' . ' WHERE m.id_parent = 0' . ' AND id_list = ' . db_ei($list_id) . ' ORDER BY last_thread_update DESC' . ' LIMIT ' . db_ei($offset) . ', ' . db_ei($chunks);
    $result = db_query($sql);
    $nbRowFound = db_numrows($result);
    // Total number of threads
    $nbThreads = 0;
    $sql = 'SELECT FOUND_ROWS() as nb';
    $res = db_query($sql);
    if ($res && !db_error($res)) {
        $row = db_fetch_array($res);
        $nbThreads = $row['nb'];
    }
    $start = $offset;
    $end = min($start + $chunks - 1, $nbRowFound - 1);
    // all threads to be displayed
    $colspan = "";
    $item = $GLOBALS['Language']->getText('plugin_forumml', 'thread');
    if (isset($offset) && $offset != 0) {
        $begin = "<a href=\"/plugins/forumml/message.php?group_id=" . $request->get('group_id') . "&list=" . $list_id . "\"><img src='" . $p->getThemePath() . "/images/ic/resultset_first.png' title='" . $GLOBALS['Language']->getText('plugin_forumml', 'begin') . "'/></a>";
        $previous = "<a href=\"/plugins/forumml/message.php?group_id=" . $request->get('group_id') . "&list=" . $list_id . "&offset=" . ($offset - $chunks) . "\"><img src='" . $p->getThemePath() . "/images/ic/resultset_previous.png' \n                  title='" . $GLOBALS['Language']->getText('plugin_forumml', 'previous', $chunks) . "'/></a>";
    } else {
        $begin = "<img src='" . $p->getThemePath() . "/images/ic/resultset_first_disabled.png'/>";
        $previous = "<img src='" . $p->getThemePath() . "/images/ic/resultset_previous_disabled.png' \n                              title='" . $GLOBALS['Language']->getText('plugin_forumml', 'previous', $chunks) . "'/>";
    }
    if ($offset + $chunks < $nbThreads) {
        $next = "<a href=\"/plugins/forumml/message.php?group_id=" . $request->get('group_id') . "&list=" . $list_id . "&offset=" . ($offset + $chunks) . "\"><img src='" . $p->getThemePath() . "/images/ic/resultset_next.png' title='" . $GLOBALS['Language']->getText('plugin_forumml', 'next', $chunks) . "'/></a>";
        $finish = "<a href=\"/plugins/forumml/message.php?group_id=" . $request->get('group_id') . "&list=" . $list_id . "&offset=" . $chunks * (int) (($nbThreads - 1) / $chunks) . "\"><img src='" . $p->getThemePath() . "/images/ic/resultset_last.png' title='" . $GLOBALS['Language']->getText('plugin_forumml', 'end') . "'/></a>";
    } else {
        $next = "<img src='" . $p->getThemePath() . "/images/ic/resultset_next_disabled.png' title='" . $chunks . "'/>";
        $finish = "<img src='" . $p->getThemePath() . "/images/ic/resultset_last_disabled.png'/>";
    }
    // display page-splitting information, at the top of threads table
    echo "<table width='100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='left' width='10%'>" . $begin . "</td>\n\t\t\t\t\t<td align='left' width='15%'>" . $previous . "</td>\n\t\t\t\t\t<td align='center' width='55%'>" . $GLOBALS['Language']->getText('plugin_forumml', 'threads') . " " . ($start + 1) . " - " . ($end + 1) . " <b>(" . $nbThreads . ")</b>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td align='right' width='10%'>\n\t\t\t\t\t\t{$next}\n\t\t\t\t\t</td>\n\t\t\t\t\t<td align='right' width='10%'>\n\t\t\t\t\t\t{$finish}\n\t\t\t\t\t</td>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t</tr>\t\n\t\t\t</table>";
    if ($nbRowFound > 0) {
        echo "<table class='border' width='100%' border='0'>\n            <tr>\n                <th class='forumml' " . $colspan . " width='60%'>" . $item . "</th>\n                <th class='forumml' width='15%'>" . $GLOBALS['Language']->getText('plugin_forumml', 'submitted_on') . "</th>\n                <th class='forumml' width='25%'>" . $GLOBALS['Language']->getText('plugin_forumml', 'author') . "</th>\n            </tr>";
        $hp =& ForumML_HTMLPurifier::instance();
        $i = 0;
        while ($msg = db_fetch_array($result)) {
            $i++;
            if ($i % 2 == 0) {
                $class = "boxitemalt";
                $headerclass = "headerlabelalt";
            } else {
                $class = "boxitem";
                $headerclass = "headerlabel";
            }
            // Get the number of messages in thread
            // nb of children + message
            $count = 1 + plugin_forumml_nb_children(array($msg['id_message']));
            // all threads
            print "<tr class='" . $class . "'><a name='" . $msg['id_message'] . "'></a>\n                    <td class='subject'>";
            if ($count > 1) {
                print "<img src='" . $p->getThemePath() . "/images/ic/comments.png'/>";
            } else {
                print "<img src='" . $p->getThemePath() . "/images/ic/comment.png'/>";
            }
            // Remove listname from suject
            $subject = preg_replace('/^[ ]*\\[' . $list_name . '\\]/i', '', $msg['subject']);
            print "<a href='message.php?group_id=" . $request->get('group_id') . "&topic=" . $msg['id_message'] . "&list=" . $request->get('list') . "'>\n\t\t\t\t\t\t\t" . $hp->purify($subject, CODENDI_PURIFIER_CONVERT_HTML) . "\n\t\t\t\t\t\t</a> <b><i>(" . $count . ")</i></b>\t\t\t\t\t\t \n\t\t\t    </td>\n                <td class='info'>" . util_timestamp_to_userdateformat(strtotime($msg['date'])) . "</td>\n                <td class='info'>" . $hp->purify($msg['sender'], CODENDI_PURIFIER_CONVERT_HTML) . "</td>\n            </tr>";
        }
        echo '</table>';
        // display page-splitting information, at the bottom of threads table
        echo "<table width='100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='left' width='10%'>" . $begin . "</td>\n\t\t\t\t\t\t<td align='left' width='15%'>" . $previous . "</td>\n\t\t\t\t\t\t<td align='center' width='55%'>" . $GLOBALS['Language']->getText('plugin_forumml', 'threads') . " " . ($start + 1) . " - " . ($end + 1) . " <b>(" . $nbThreads . ")</b>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td align='right' width='10%'>\n\t\t\t\t\t\t\t{$next}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td align='right' width='10%'>\n\t\t\t\t\t\t\t{$finish}\n\t\t\t\t\t\t</td>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t</tr>\t\n\t\t\t\t</table>";
    }
}
 /**
  * Get the list of all futur obsolete documents and warn document owner
  * about this obsolescence.
  */
 function notifyFuturObsoleteDocuments()
 {
     $pm = ProjectManager::instance();
     $itemFactory = new Docman_ItemFactory(0);
     //require_once('common/mail/TestMail.class.php');
     //$mail = new TestMail();
     //$mail->_testDir = '/local/vm16/codev/servers/docman-2.0/var/spool/mail';
     $itemIter = $itemFactory->findFuturObsoleteItems();
     $itemIter->rewind();
     while ($itemIter->valid()) {
         $item =& $itemIter->current();
         // Users
         $um =& UserManager::instance();
         $owner =& $um->getUserById($item->getOwnerId());
         // Project
         $group = $pm->getProject($item->getGroupId());
         // Date
         $obsoDate = util_timestamp_to_userdateformat($item->getObsolescenceDate(), true);
         // Urls
         $baseUrl = get_server_url() . $this->pluginPath . '/index.php?group_id=' . $item->getGroupId() . '&id=' . $item->getId();
         $directUrl = $baseUrl . '&action=show';
         $detailUrl = $baseUrl . '&action=details';
         $subj = $this->txt('obso_warn_email_subject', array($GLOBALS['sys_name'], $item->getTitle()));
         $body = $this->txt('obso_warn_email_body', array($item->getTitle(), $group->getPublicName(), $obsoDate, $directUrl, $detailUrl));
         $mail_notification_builder = new MailNotificationBuilder(new MailBuilder(TemplateRendererFactory::build()));
         $mail_notification_builder->buildAndSendEmail($group, array($owner->getEmail()), $subj, '', $body, $baseUrl, DocmanPlugin::TRUNCATED_SERVICE_NAME, new MailEnhancer());
         $itemIter->next();
     }
 }
 function _getReviews($reviewer = true)
 {
     $hp = Codendi_HTMLPurifier::instance();
     require_once 'www/my/my_utils.php';
     $html = '';
     $content_html_id = 'plugin_docman_approval_' . ($reviewer ? 'reviewer' : 'requester');
     $html .= '<div style="font-weight:bold;">';
     $html .= $GLOBALS['HTML']->getImage('pointer_down.png', array('id' => $content_html_id . '_icon', 'onclick' => "plugin_docman_approval_toggle('{$content_html_id}', true)")) . ' ';
     if ($reviewer) {
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_reviews_reviewer');
     } else {
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_reviews_requester');
     }
     $html .= '</div>';
     $html .= '<div id="' . $content_html_id . '" style="padding-left:20px;">';
     $um =& UserManager::instance();
     $user =& $um->getCurrentUser();
     if ($reviewer) {
         $reviewsArray = Docman_ApprovalTableReviewerFactory::getAllPendingReviewsForUser($user->getId());
     } else {
         $reviewsArray = Docman_ApprovalTableReviewerFactory::getAllApprovalTableForUser($user->getId());
     }
     if (count($reviewsArray) > 0) {
         $request =& HTTPRequest::instance();
         // Get hide arguments
         $hideItemId = (int) $request->get('hide_item_id');
         $hideApproval = null;
         if ($request->exist('hide_plugin_docman_approval')) {
             $hideApproval = (int) $request->get('hide_plugin_docman_approval');
         }
         $prevGroupId = -1;
         $hideNow = false;
         $i = 0;
         $html .= '<table style="width:100%">';
         //$html .= '<TR><TD colspan="2">Reviewer - Requester</TD></TR>';
         foreach ($reviewsArray as $review) {
             if ($review['group_id'] != $prevGroupId) {
                 list($hideNow, $count_diff, $hideUrl) = my_hide_url('plugin_docman_approval', $review['group_id'], $hideItemId, 1, $hideApproval);
                 $docmanUrl = $this->pluginPath . '/?group_id=' . $review['group_id'];
                 $docmanHref = '<a href="' . $docmanUrl . '">' . $review['group'] . '</a>';
                 if ($prevGroupId != -1) {
                     if ($reviewer) {
                         $colspan = 2;
                     } else {
                         $colspan = 3;
                     }
                     $html .= '<tr class="boxitem"><td colspan="' . $colspan . '">';
                 }
                 $html .= '<strong>' . $hideUrl . $docmanHref . '</strong></td></tr>';
                 $i = 0;
             }
             if (!$hideNow) {
                 $html .= '<tr class="' . util_get_alt_row_color($i++) . '">';
                 // Document
                 $html .= '<td align="left">';
                 $html .= '<a href="' . $review['url'] . '">' . $hp->purify($review['title'], CODENDI_PURIFIER_CONVERT_HTML) . '</a>';
                 $html .= '</td>';
                 // For requester, precise the status
                 if (!$reviewer) {
                     $html .= '<td align="right">';
                     $html .= $review['status'];
                     $html .= '</td>';
                 }
                 // Date
                 $html .= '<td align="right">';
                 $html .= util_timestamp_to_userdateformat($review['date'], true);
                 $html .= '</td>';
                 $html .= '</tr>';
             }
             $prevGroupId = $review['group_id'];
         }
         $html .= '</table>';
     } else {
         if ($reviewer) {
             $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_no_review');
         } else {
             $html .= $GLOBALS['Language']->getText('plugin_docman', 'my_no_request');
         }
     }
     $html .= '</div>';
     if (user_get_preference('hide_plugin_docman_approval_' . ($reviewer ? 'reviewer' : 'requester'))) {
         $html .= '<script type="text/javascript">';
         $html .= "document.observe('dom:loaded', function() \n                {\n                    plugin_docman_approval_toggle('{$content_html_id}', false);\n                }\n            );\n            </script>";
     }
     return $html;
 }
Exemple #13
0
 function getDay()
 {
     return util_timestamp_to_userdateformat($this->_date / 1000, true);
 }
 function getDisabledTable($groupId)
 {
     $dwLog = new DocmanWatermark_ItemFactory();
     $dar = $dwLog->getNotWatermarkedByProject($groupId);
     $html = '<h3>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'admin_disabled_title') . '</h3>';
     $html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'admin_disabled_desc') . '</p>';
     if ($dar && $dar->rowCount() > 0) {
         $titles = array($GLOBALS['Language']->getText('plugin_docmanwatermark', 'admin_disabled_document'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'admin_disabled_when'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'admin_disabled_directaccess'));
         $html .= html_build_list_table_top($titles, false, false, false);
         $altColor = 0;
         $previousItem = null;
         foreach ($dar as $row) {
             if ($row['item_id'] != $previousItem) {
                 $html .= '<tr class="' . html_get_alt_row_color($altColor++) . '">';
                 $html .= '<td>' . $row['title'] . '</td>';
                 $html .= '<td>' . util_timestamp_to_userdateformat($row['time']) . '</td>';
                 $html .= '<td><a href="' . $this->_controller->getDefaultUrl() . '&action=details&id=' . $row['item_id'] . '&section=watermarking">' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'admin_disabled_link') . '</a></td>';
                 $html .= '<tr>';
                 $previousItem = $row['item_id'];
             }
         }
         $html .= '</table>';
     }
     return $html;
 }