/** * Update row * * @param SeekR_Row $row */ public final function updateRow(SeekR_Row $row) { // Insert $this->_db->query("UPDATE {$this->_db->quoteIdentifier($this->_name)}\nSET " . $this->_setValues(array_diff_assoc($row->toArray(), $row->getPrimaryKey())) . "\nWHERE " . $this->buildWhere($row->getPrimaryKey())); // Refresh $this->refreshRow($row); }
/** * Get scan list for mail * * @return string */ protected final function _getScanListForMail() { $summary = array('ids' => array(), 'errors' => 0, 'fileChanges' => 0, 'fileDateOnlyChanges' => 0, 'directoryChanges' => 0, 'directoryDateOnlyChanges' => 0); $list = array(); foreach ($this->_db->query("\n\t\t\tSELECT\n\t\t\t\t`scanID`,\n\t\t\t\t`startDate`,\n\t\t\t\t`endDate`,\n\t\t\t\t`errors`,\n\t\t\t\t`fileChanges`,\n\t\t\t\t`fileDateOnlyChanges`,\n\t\t\t\t`directoryChanges`,\n\t\t\t\t`directoryDateOnlyChanges`\n\t\t\tFROM `scan`\n\t\t\tWHERE `status` = 'done'\n\t\t\t\tAND `mailSent` = 'no'\n\t\t")->fetchAll(PDO::FETCH_ASSOC) as $row) { // Result $summary['ids'][] = $row['scanID']; $summary['errors'] += $row['errors']; $summary['fileChanges'] += $row['fileChanges']; $summary['fileDateOnlyChanges'] += $row['fileDateOnlyChanges']; $summary['directoryChanges'] += $row['directoryChanges']; $summary['directoryDateOnlyChanges'] += $row['directoryDateOnlyChanges']; // Date $row['startDate'] = $this->_formatMailDate($row['startDate']); $end = explode(' ', $this->_formatMailDate($row['endDate'])); $row['endDate'] = $end[1]; // Numeric values foreach ($row as $key => $value) { if (is_numeric($value) && $value != 0) { $row[$key] = array('class' => 'Highlight', 'value' => $value); } } $list[] = $row; } // Footer data $footer = array_merge(array('scanID' => null, 'startDate' => null, 'endDate' => null), $summary); // Numeric values foreach ($footer as $key => $value) { if (is_numeric($value) && $value != 0) { $footer[$key] = array('class' => 'Highlight', 'value' => $value); } } // Generate content $summary['content'] = $this->_table('Scans', $this->_scanListColumns, $list, array($footer)); return $summary; }